Skip to content

Commit

Permalink
Changing std::filesystem::path to fs::path to accommodate macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfb committed Jul 28, 2024
1 parent 7aaca15 commit f1041a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/cinder/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ CI_API fs::path getDocumentsDirectory();
CI_API void limitDirectoryFileCount( const fs::path& directoryPath, size_t maxFileCount, std::function<bool(const fs::path&, const fs::path&)> sortFn = []( const fs::path& p1, const fs::path& p2 ) -> bool { return fs::last_write_time( p1 ) > fs::last_write_time( p2 ); } );

//! Searches upwards from \a start (file or directory) for an ancestor directory where \a relativeSearch exists, up to \a maxDepth levels; returns absolute path if found, otherwise empty path.
CI_API std::filesystem::path findAncestorDir( const std::filesystem::path& start, const std::filesystem::path& relativeSearch, int maxDepth = 10 );
CI_API fs::path findAncestorDir( const fs::path& start, const fs::path& relativeSearch, int maxDepth = 10 );
//! Searches upwards from \a start (file or directory) for an ancestor file where \a relativeSearch exists, up to \a maxDepth levels; returns absolute path if found, otherwise empty path.
CI_API std::filesystem::path findAncestorFile( const std::filesystem::path& start, const std::filesystem::path& relativeSearch, int maxDepth = 10 );
CI_API fs::path findAncestorFile( const fs::path& start, const fs::path& relativeSearch, int maxDepth = 10 );

//! Launches a path in a web browser
CI_API void launchWebBrowser( const Url &url );
Expand Down
8 changes: 4 additions & 4 deletions src/cinder/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void limitDirectoryFileCount( const fs::path& directoryPath, size_t maxFileCount
}
}

std::filesystem::path findAncestorFile( const std::filesystem::path& start, const std::filesystem::path& relativeSearch, int maxDepth )
fs::path findAncestorFile( const fs::path& start, const fs::path& relativeSearch, int maxDepth )
{
size_t parentCt = 0;
for( fs::path curPath = start; curPath.has_parent_path() && parentCt <= maxDepth; curPath = curPath.parent_path(), ++parentCt ) {
Expand All @@ -87,10 +87,10 @@ std::filesystem::path findAncestorFile( const std::filesystem::path& start, cons
return testDir;
}

return std::filesystem::path();
return fs::path();
}

std::filesystem::path findAncestorDir( const std::filesystem::path& start, const std::filesystem::path& relativeSearch, int maxDepth )
fs::path findAncestorDir( const fs::path& start, const fs::path& relativeSearch, int maxDepth )
{
size_t parentCt = 0;
for( fs::path curPath = start; curPath.has_parent_path() && parentCt <= maxDepth; curPath = curPath.parent_path(), ++parentCt ) {
Expand All @@ -99,7 +99,7 @@ std::filesystem::path findAncestorDir( const std::filesystem::path& start, const
return testDir;
}

return std::filesystem::path();
return fs::path();
}

void launchWebBrowser( const Url &url )
Expand Down
2 changes: 1 addition & 1 deletion src/cinder/app/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const vector<fs::path>& Platform::getAssetDirectories() const

void Platform::findAndAddDefaultAssetPath()
{
std::filesystem::path assetDir = findAncestorDir( getExecutablePath().parent_path(), "assets", ASSET_SEARCH_DEPTH );
fs::path assetDir = findAncestorDir( getExecutablePath().parent_path(), "assets", ASSET_SEARCH_DEPTH );
if( ! assetDir.empty() )
addAssetDirectory( assetDir );
}
Expand Down

0 comments on commit f1041a1

Please sign in to comment.