Skip to content

Commit 5daa136

Browse files
committed
Merge branch 'hotfix/v0.9.1'
2 parents 6467acf + 71ad37b commit 5daa136

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif ( NOT CMAKE_INSTALL_PREFIX )
1212

1313
set ( PROJECT_VERSION_MAJOR 0 )
1414
set ( PROJECT_VERSION_MINOR 9 )
15-
set ( PROJECT_VERSION_PATCH 0 )
15+
set ( PROJECT_VERSION_PATCH 1 )
1616

1717
# We only support building nomlib as a dynamic library at the moment
1818
set ( BUILD_SHARED_LIBS on )

include/nomlib/system/osx/ResourcePath.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
#include <string>
3333
#include <cstring>
3434

35+
#include <CoreServices/CoreServices.h>
3536
#include <CoreFoundation/CoreFoundation.h>
3637

3738
#include "nomlib/config.hpp"
@@ -60,9 +61,22 @@ namespace nom {
6061
/// bundle, or else this function call will fail.
6162
///
6263
/// Returns a null terminated string on err
63-
6464
const std::string getBundleResourcePath ( const std::string& identifier = "\0" );
6565

66+
/// Obtain the path to the logged in user's Documents folder
67+
///
68+
/// $HOME/Documents/
69+
///
70+
/// These are standard folders that may be used for saving user data under.
71+
const std::string user_documents_path ( void );
72+
73+
/// Obtain the path to the logged in user's Application Support folder
74+
///
75+
/// $HOME/Library/Application\ Support/
76+
///
77+
/// These are standard folders that may be used for saving user data under.
78+
const std::string user_app_support_path ( void );
79+
6680
} // namespace nom
6781

6882
#endif // include guard

src/system/osx/ResourcePath.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,31 @@ NOM_LOG_ERR ( NOM, "Could not obtain the bundle's Resources path." );
6868
return resources_path;
6969
}
7070

71+
const std::string user_documents_path ( void )
72+
{
73+
FSRef ref;
74+
OSType folderType = kDocumentsFolderType;
75+
char path[PATH_MAX];
76+
77+
FSFindFolder ( kUserDomain, folderType, kCreateFolder, &ref );
78+
79+
FSRefMakePath ( &ref, (uint8*) &path, PATH_MAX );
80+
81+
return std::string ( path );
82+
}
83+
84+
const std::string user_app_support_path ( void )
85+
{
86+
FSRef ref;
87+
OSType folderType = kApplicationSupportFolderType;
88+
char path[PATH_MAX];
89+
90+
FSFindFolder ( kUserDomain, folderType, kCreateFolder, &ref );
91+
92+
FSRefMakePath ( &ref, (uint8*) &path, PATH_MAX );
93+
94+
return std::string ( path );
95+
}
96+
7197

7298
} // namespace nom

0 commit comments

Comments
 (0)