std::string FileUtils::tempPath() { #ifdef PLATFORM_UNIX return "/tmp"; #else char buffer[MAX_PATH+1]; GetTempPath(MAX_PATH+1,buffer); return toUnixPathSeparators(buffer); #endif }
std::string FileUtils::tempPath() { #ifdef PLATFORM_UNIX std::string tmpDir(notNullString(getenv("TMPDIR"))); if (tmpDir.empty()) { tmpDir = "/tmp"; } return tmpDir; #else char buffer[MAX_PATH+1]; GetTempPath(MAX_PATH+1,buffer); return toUnixPathSeparators(buffer); #endif }
std::string FileUtils::getcwd() throw (IOException) { #ifdef PLATFORM_UNIX char path[PATH_MAX]; if (!::getcwd(path,PATH_MAX)) { throw FileUtils::IOException("Failed to get current directory"); } return std::string(path); #else char path[MAX_PATH]; if (GetCurrentDirectory(MAX_PATH,path) == 0) { throw FileUtils::IOException("Failed to get current directory"); } return toUnixPathSeparators(std::string(path)); #endif }