Initial commit
This commit is contained in:
57
application/source/examples/example.file.system.c
Normal file
57
application/source/examples/example.file.system.c
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
#include "../fileSystem.h"
|
||||
|
||||
#include "../console.h"
|
||||
|
||||
void main() {
|
||||
|
||||
char * directory2 = "./assets/";
|
||||
|
||||
fileSystem * filesystem = new fileSystem();
|
||||
|
||||
char * directory = "./assets/";
|
||||
|
||||
|
||||
|
||||
filesystem->writeFile( "./assets/testFile", "content of file" );
|
||||
|
||||
|
||||
array * files = filesystem->readDir( directory );
|
||||
|
||||
int fileCount = files->length();
|
||||
|
||||
for ( int i = 0; i < fileCount; ++i )
|
||||
{
|
||||
|
||||
char * filename = files->get( i );
|
||||
|
||||
char * path = directory->concatenate( filename );
|
||||
|
||||
char * source = filesystem->readFile( path );
|
||||
|
||||
|
||||
printf("filename: %s\n", path);
|
||||
|
||||
printf("source: %s\n\n\n", source);
|
||||
|
||||
}
|
||||
|
||||
if( filesystem->ensureDirectory("./Some/example/assure") ) {
|
||||
|
||||
console.log("Directories successfuly created.");
|
||||
|
||||
}
|
||||
|
||||
if( filesystem->exists( "Some" ) ) {
|
||||
|
||||
console.log("Directories 'Some' does exist.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void abort() {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user