1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added File::commonDocumentsDirectory enum.

This commit is contained in:
jules 2013-08-31 16:15:07 +01:00
parent 0ded32be3e
commit 725334d78c
5 changed files with 22 additions and 15 deletions

View file

@ -762,6 +762,15 @@ public:
/** The folder that contains the user's desktop objects. */
userDesktopDirectory,
/** The most likely place where a user might store their music files. */
userMusicDirectory,
/** The most likely place where a user might store their movie files. */
userMoviesDirectory,
/** The most likely place where a user might store their picture files. */
userPicturesDirectory,
/** The folder in which applications store their persistent user-specific settings.
On Windows, this might be "\Documents and Settings\username\Application Data".
On the Mac, it might be "~/Library". If you're going to store your settings in here,
@ -779,6 +788,13 @@ public:
*/
commonApplicationDataDirectory,
/** A place to put documents which are shared by all users of the machine.
On Windows this may be somewhere like "C:\Users\Public\Documents", on OSX it
will be something like "/Users/Shared". Other OSes may have no such concept
though, so be careful.
*/
commonDocumentsDirectory,
/** The folder that should be used for temporary files.
Always delete them when you're finished, to keep the user's computer tidy!
*/
@ -821,16 +837,7 @@ public:
So on windows, this would be something like "c:\program files", on the
Mac "/Applications", or "/usr" on linux.
*/
globalApplicationsDirectory,
/** The most likely place where a user might store their music files. */
userMusicDirectory,
/** The most likely place where a user might store their movie files. */
userMoviesDirectory,
/** The most likely place where a user might store their picture files. */
userPicturesDirectory
globalApplicationsDirectory
};
/** Finds the location of a special type of file or directory, such as a home folder or

View file

@ -112,13 +112,13 @@ File File::getSpecialLocation (const SpecialLocationType type)
return File (android.appDataDir);
case commonApplicationDataDirectory:
case commonDocumentsDirectory:
return File (android.appDataDir);
case globalApplicationsDirectory:
return File ("/system/app");
case tempDirectory:
//return File (AndroidStatsHelpers::getSystemProperty ("java.io.tmpdir"));
return File (android.appDataDir).getChildFile (".temp");
case invokedExecutableFile:

View file

@ -168,11 +168,8 @@ File File::getSpecialLocation (const SpecialLocationType type)
const char* homeDir = getenv ("HOME");
if (homeDir == nullptr)
{
struct passwd* const pw = getpwuid (getuid());
if (pw != nullptr)
if (struct passwd* const pw = getpwuid (getuid()))
homeDir = pw->pw_dir;
}
return File (CharPointer_UTF8 (homeDir));
}
@ -183,6 +180,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
case userPicturesDirectory: return resolveXDGFolder ("XDG_PICTURES_DIR", "~");
case userDesktopDirectory: return resolveXDGFolder ("XDG_DESKTOP_DIR", "~/Desktop");
case userApplicationDataDirectory: return File ("~");
case commonDocumentsDirectory:
case commonApplicationDataDirectory: return File ("/var");
case globalApplicationsDirectory: return File ("/usr");

View file

@ -213,6 +213,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
case userPicturesDirectory: resultPath = "~/Pictures"; break;
case userApplicationDataDirectory: resultPath = "~/Library"; break;
case commonApplicationDataDirectory: resultPath = "/Library"; break;
case commonDocumentsDirectory: resultPath = "/Users/Shared"; break;
case globalApplicationsDirectory: resultPath = "/Applications"; break;
case invokedExecutableFile:

View file

@ -518,6 +518,7 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type)
case userDesktopDirectory: csidlType = CSIDL_DESKTOP; break;
case userApplicationDataDirectory: csidlType = CSIDL_APPDATA; break;
case commonApplicationDataDirectory: csidlType = CSIDL_COMMON_APPDATA; break;
case commonDocumentsDirectory: csidlType = CSIDL_COMMON_DOCUMENTS; break;
case globalApplicationsDirectory: csidlType = CSIDL_PROGRAM_FILES; break;
case userMusicDirectory: csidlType = 0x0d; /*CSIDL_MYMUSIC*/ break;
case userMoviesDirectory: csidlType = 0x0e; /*CSIDL_MYVIDEO*/ break;