mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-04 21:34:41 +00:00
[vfs #1] Add ttvfs, miniz, and minihttp sources
This commit is contained in:
parent
99e3f5ebe2
commit
a90f57afb0
36 changed files with 10047 additions and 0 deletions
76
ExternalLibs/ttvfs/VFSSystemPaths.cpp
Normal file
76
ExternalLibs/ttvfs/VFSSystemPaths.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifdef _WIN32
|
||||
# include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include "VFSSystemPaths.h"
|
||||
#include "VFSTools.h"
|
||||
#include "VFSInternal.h"
|
||||
|
||||
VFS_NAMESPACE_START
|
||||
|
||||
|
||||
std::string GetUserDir()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
TCHAR szPath[MAX_PATH];
|
||||
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, 0, szPath)))
|
||||
{
|
||||
return szPath;
|
||||
}
|
||||
|
||||
// Fallback
|
||||
const char *user = getenv("USERPROFILE");
|
||||
if(user)
|
||||
return user;
|
||||
|
||||
// Sorry, windoze :(
|
||||
return "";
|
||||
|
||||
#else // Assume POSIX compliance
|
||||
const char *user = getenv("HOME");
|
||||
if(user)
|
||||
return user;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string GetAppDir(const char *appname)
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
TCHAR szPath[MAX_PATH];
|
||||
|
||||
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath)))
|
||||
{
|
||||
ret = szPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback
|
||||
const char *user = getenv("APPDATA");
|
||||
if(user)
|
||||
ret = user;
|
||||
else
|
||||
ret = "."; // Seems we have no other choice
|
||||
}
|
||||
|
||||
return FixPath(ret + '/' + appname);
|
||||
|
||||
#else // Assume POSIX compliance
|
||||
|
||||
const char *user = getenv("HOME");
|
||||
if(user)
|
||||
ret = user;
|
||||
else
|
||||
ret = ".";
|
||||
|
||||
return FixPath(ret + "/." + appname); // just in case
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
VFS_NAMESPACE_END
|
Loading…
Add table
Add a link
Reference in a new issue