23 struct stat stFileInfo;
24 if (stat(pathfilename.c_str(), &stFileInfo) == 0)
30 NSString* nsPath = [NSString stringWithCString:path.c_str()
31 encoding:[NSString defaultCStringEncoding]];
32 NSString* nsFile = [NSString stringWithCString:file.c_str()
33 encoding:[NSString defaultCStringEncoding]];
35 NSFileManager* fileManager = [NSFileManager defaultManager];
36 if ([fileManager fileExistsAtPath:nsPath])
39 [fileManager fileExistsAtPath:nsPath isDirectory:(&isDir)];
43 contents = [fileManager contentsOfDirectoryAtPath:nsPath error:nil];
46 for (NSString* entity in contents)
50 if ([entity length] == [nsFile length])
52 if ([entity caseInsensitiveCompare:nsFile] == NSOrderedSame)
55 pathfilename = path + [entity UTF8String];
67 vector<string> folderContent;
73 NSString* nsPath = [NSString stringWithCString:path.c_str()
74 encoding:[NSString defaultCStringEncoding]];
75 NSString* nsFolder = [NSString stringWithCString:folder.c_str()
76 encoding:[NSString defaultCStringEncoding]];
78 NSFileManager* fileManager = [NSFileManager defaultManager];
80 if ([fileManager fileExistsAtPath:nsPath])
83 [fileManager fileExistsAtPath:nsPath isDirectory:(&isDir)];
88 contents = [fileManager contentsOfDirectoryAtPath:nsPath error:nil];
90 for (NSString* entity in contents)
92 folderContent.emplace_back(path + [entity UTF8String]);
102 NSArray* paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
105 NSString* libraryDirectory = [paths objectAtIndex:0];
106 string configDir = [libraryDirectory UTF8String];
107 configDir +=
"/SLProject";
108 NSString* configPath = [NSString stringWithUTF8String:configDir.c_str()];
112 if (![[NSFileManager defaultManager] fileExistsAtPath:configPath])
113 [[NSFileManager defaultManager] createDirectoryAtPath:configPath
114 withIntermediateDirectories:NO
118 return configDir +
"/";
125 NSString* bundlePath = [[NSBundle mainBundle] resourcePath];
126 string cwd = [bundlePath UTF8String];
133 return remove(pathfilename.c_str()) != 0;
static bool deleteFile(std::string &pathfilename)
Deletes a file on the filesystem.
static std::vector< std::string > getAllNamesInDir(const std::string &dirName, bool fullPath=true)
Returns all files and folders in a directory as a vector.
static std::string getCurrentWorkingDir()
Returns the working directory.
static bool fileExists(std::string &pathfilename)
Returns true if a file exists.
static std::string getAppsWritableDir()
Returns the writable configuration directory.
string getFileName(const string &pathFilename)
Returns the filename of path-filename string.
string getPath(const string &pathFilename)
Returns the path w. '\' of path-filename string.