Saving directories
This commit is contained in:
parent
9d77b2709f
commit
fa3dd77e96
5 changed files with 171 additions and 25 deletions
|
@ -127,12 +127,21 @@ int ipfs_node_protobuf_decode(unsigned char* buffer, size_t buffer_length, struc
|
|||
* Node Functions
|
||||
*===================================================================================*/
|
||||
|
||||
/*ipfs_node_new
|
||||
/****
|
||||
* Creates an empty node, allocates the required memory
|
||||
* Returns a fresh new node with no data set in it.
|
||||
* @param node the pointer to the memory allocated
|
||||
* @returns true(1) on success, otherwise false(0)
|
||||
*/
|
||||
int ipfs_node_new(struct Node** node);
|
||||
|
||||
/***
|
||||
* Allocates memory for a node, and sets the data section to indicate
|
||||
* that this node is a directory
|
||||
* @param node the node to initialize
|
||||
* @returns true(1) on success, otherwise false(0)
|
||||
*/
|
||||
int ipfs_node_create_directory(struct Node** node);
|
||||
|
||||
/**
|
||||
* sets the Cid into the struct element titled cached
|
||||
* @param node the node to work with
|
||||
|
|
|
@ -8,6 +8,18 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* a linked list to store filenames
|
||||
*/
|
||||
struct FileList {
|
||||
char* file_name;
|
||||
struct FileList* next;
|
||||
};
|
||||
|
||||
struct FileList* os_utils_list_directory(const char* path);
|
||||
// frees memory used by creating a FileList linked list
|
||||
int os_utils_free_file_list(struct FileList* first);
|
||||
|
||||
/**
|
||||
* get an environment varible from the os
|
||||
* @param variable the variable to look for
|
||||
|
@ -38,4 +50,11 @@ int os_utils_directory_writeable(const char* path);
|
|||
|
||||
int os_utils_directory_exists(const char* path);
|
||||
|
||||
/**
|
||||
* Determine if the path presented is actually a directory
|
||||
* @param file_name the path to examine
|
||||
* @returns true(1) if file_name is actually a directory
|
||||
*/
|
||||
int os_utils_is_directory(const char* file_name);
|
||||
|
||||
#endif /* utils_h */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue