Skip to content
Browse files

Fixed failed creation of file paths relative to cwd

  • Loading branch information...
1 parent ba5d1c0 commit 5e8756e51edc5b04b2191d1bf3eb3a0430a91bef @andrewfb andrewfb committed Oct 3, 2010
Showing with 5 additions and 2 deletions.
  1. +1 −1 src/cinder/DataTarget.cpp
  2. +4 −1 src/cinder/Utilities.cpp
View
2 src/cinder/DataTarget.cpp
@@ -89,7 +89,7 @@ DataTargetPathRef writeFile( const std::string &path, bool createParents )
createDirectories( getPathDirectory( path ) );
}
- return DataTargetPath::createRef( path );
+ return DataTargetPath::createRef( path );
}
} // namespace cinder
View
5 src/cinder/Utilities.cpp
@@ -150,7 +150,7 @@ std::string getPathDirectory( const std::string &path )
{
size_t lastSlash = path.rfind( getPathSeparator(), path.length() );
if( lastSlash == string::npos ) {
- return path;
+ return "";
}
else
return path.substr( 0, lastSlash );
@@ -180,6 +180,9 @@ std::string getPathExtension( const std::string &path )
bool createDirectories( const std::string &path, bool createParents )
{
+ if( path.empty() )
+ return true;
+
#if defined( CINDER_COCOA )
NSString *pathNS = [NSString stringWithCString:path.c_str() encoding:NSUTF8StringEncoding];
return static_cast<bool>( [[NSFileManager defaultManager] createDirectoryAtPath:pathNS withIntermediateDirectories:YES attributes:nil error:nil] );

0 comments on commit 5e8756e

Please sign in to comment.
Something went wrong with that request. Please try again.