Do some minor code cleanups
This commit is contained in:
parent
45285a4a66
commit
3db710f101
2 changed files with 3 additions and 5 deletions
|
|
@ -29,7 +29,7 @@ const fs::path& getUserDocumentsDirectory()
|
||||||
const fs::path& getUserDocumentsDirectory()
|
const fs::path& getUserDocumentsDirectory()
|
||||||
{
|
{
|
||||||
static const fs::path directory = []() -> fs::path {
|
static const fs::path directory = []() -> fs::path {
|
||||||
const gchar *path = g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS);
|
const gchar* path = g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS);
|
||||||
if (!path)
|
if (!path)
|
||||||
throw std::runtime_error("Cannot get the document directory.");
|
throw std::runtime_error("Cannot get the document directory.");
|
||||||
return fs::path(path);
|
return fs::path(path);
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,11 @@
|
||||||
#error This source file requires ARC
|
#error This source file requires ARC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
const fs::path& getUserDocumentsDirectory()
|
const fs::path& getUserDocumentsDirectory()
|
||||||
{
|
{
|
||||||
static const fs::path directory = []() -> fs::path {
|
static const fs::path directory = []() -> fs::path {
|
||||||
NSFileManager *fm = [NSFileManager defaultManager];
|
NSFileManager* fm = [NSFileManager defaultManager];
|
||||||
NSArray<NSURL *> *urls = [fm URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
|
NSArray<NSURL*>* urls = [fm URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
|
||||||
for (NSUInteger i = 0, n = [urls count]; i < n; ++i) {
|
for (NSUInteger i = 0, n = [urls count]; i < n; ++i) {
|
||||||
NSURL *url = [urls objectAtIndex:i];
|
NSURL *url = [urls objectAtIndex:i];
|
||||||
if ([url isFileURL])
|
if ([url isFileURL])
|
||||||
|
|
@ -26,4 +25,3 @@ const fs::path& getUserDocumentsDirectory()
|
||||||
}();
|
}();
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue