MacOS and Android versions are untested.
return thread->get_internal_data_path();
}
+Path get_temp_dir()
+{
+ // TODO Should use Context.getCacheDir(), but it's a Java function.
+ return get_home_dir();
+}
+
} // namespace FS
} // namespace Msp
/// Returns a directory containing system-wide architecture-specific files.
MSPCORE_API Path get_sys_lib_dir();
+/// Returns a directory suitable for storing temporary files.
+MSPCORE_API Path get_temp_dir();
+
/** Looks for a file in a list of paths. Returns the absolute path to the
first existing location, or an empty Path if the file is not found at all. */
MSPCORE_API Path path_lookup(const std::string &, const std::vector<Path> &);
return [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
}
+
+unsigned get_temp_dir(char *buf, unsigned size)
+{
+ NSString *path = NSTemporaryDirectory();
+ if(![path getCString:buf maxLength:size encoding:NSUTF8StringEncoding])
+ return 0;
+
+ return [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+}
extern "C" unsigned get_home_dir(char *, unsigned);
extern "C" unsigned get_application_support_dir(char *, unsigned);
+extern "C" unsigned get_temp_dir(char *, unsigned);
namespace Msp {
namespace FS {
return get_home_dir()/"Library"/"Application Support"/appname;
}
+Path get_temp_dir()
+{
+ string tmp = getenv("TMPDIR");
+ if(!tmp.empty())
+ return tmp;
+
+ char buf[1024];
+ unsigned len = ::get_temp_dir(buf, sizeof(buf));
+ if(len)
+ return string(buf, len);
+
+ return "/tmp";
+}
+
} // namespace FS
} // namespace Msp
return get_home_dir()/("."+appname);
}
+Path get_temp_dir()
+{
+ string tmp = getenv("TMPDIR");
+ if(!tmp.empty())
+ return tmp;
+ return "/tmp";
+}
+
} // namespace FS
} // namespace Msp
return ".";
}
+Path get_temp_dir()
+{
+ char temp[MAX_PATH+1];
+ if(GetTempPath(sizeof(temp), temp))
+ return temp;
+ return ".";
+}
+
} // namespace FS
} // namespace Msp