|
|
@@ -1067,4 +1067,22 @@ bool IsAbsolutePath(const String& pathName)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+String FileSystem::GetTemporaryDir() const
|
|
|
+{
|
|
|
+#if defined(_WIN32)
|
|
|
+ wchar_t pathName[MAX_PATH];
|
|
|
+ pathName[0] = 0;
|
|
|
+ GetTempPathW(SDL_arraysize(pathName), pathName);
|
|
|
+ return AddTrailingSlash(pathName);
|
|
|
+#else
|
|
|
+ if (char* pathName = getenv("TMPDIR"))
|
|
|
+ return AddTrailingSlash(pathName);
|
|
|
+#ifdef P_tmpdir
|
|
|
+ return AddTrailingSlash(P_tmpdir);
|
|
|
+#else
|
|
|
+ return "/tmp/";
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
}
|