----------------------------------------------------------------------------------------------------- Purpose: Returns the root of the directory the system wants us to store user documents in -----------------------------------------------------------------------------------------------------
| 926 | // Purpose: Returns the root of the directory the system wants us to store user documents in |
| 927 | // ----------------------------------------------------------------------------------------------------- |
| 928 | std::string GetUserDocumentsPath() |
| 929 | { |
| 930 | #if defined( WIN32 ) |
| 931 | WCHAR rwchPath[MAX_PATH]; |
| 932 | |
| 933 | if ( !SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_MYDOCUMENTS | CSIDL_FLAG_CREATE, NULL, 0, rwchPath ) ) ) |
| 934 | { |
| 935 | return ""; |
| 936 | } |
| 937 | |
| 938 | // Convert the path to UTF-8 and store in the output |
| 939 | std::string sUserPath = UTF16to8( rwchPath ); |
| 940 | |
| 941 | return sUserPath; |
| 942 | #elif defined( OSX ) |
| 943 | @autoreleasepool { |
| 944 | NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES ); |
| 945 | if ( [paths count] == 0 ) |
| 946 | { |
| 947 | return ""; |
| 948 | } |
| 949 | |
| 950 | return [[paths objectAtIndex:0] UTF8String]; |
| 951 | } |
| 952 | #elif defined( LINUX ) |
| 953 | // @todo: not solved/changed as part of OSX - still not real - just removed old class based steam cut and paste |
| 954 | const char *pchHome = getenv( "HOME" ); |
| 955 | if ( pchHome == NULL ) |
| 956 | { |
| 957 | return ""; |
| 958 | } |
| 959 | return pchHome; |
| 960 | #endif |
| 961 | } |
| 962 | |
| 963 | |
| 964 | // ----------------------------------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected