Skip to content

Commit d5e56e2

Browse files
committed
Fix tests on macos
1 parent ca7d6e1 commit d5e56e2

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Debug",
9+
"type": "cppdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/Bin/Debug/PlatformTests",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "${workspaceFolder}/Bin/Debug",
15+
"environment": [],
16+
"externalConsole": true,
17+
"MIMode": "lldb"
18+
}
19+
]
20+
}

Source/Platform/File.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,32 @@ void Helium::SplitDirectories( const std::string& path, std::vector< std::string
77
{
88
static char pathSep[ 2 ] = { Helium::PathSeparator, '\0' };
99

10+
output.clear();
11+
if ( path.empty() )
12+
{
13+
return;
14+
}
15+
16+
std::string newRoot = path;
17+
if ( newRoot[0] == Helium::PathSeparator )
18+
{
19+
newRoot.erase( 0, 1 );
20+
}
21+
1022
std::string::size_type start = 0, end = 0;
11-
for ( ; ( end = path.find( Helium::PathSeparator, start ) ) != std::string::npos; start = end + 1 )
23+
for ( ; ( end = newRoot.find( Helium::PathSeparator, start ) ) != std::string::npos; start = end + 1 )
1224
{
1325
if ( start != end )
1426
{
15-
std::string substr = path.substr( start, end - start );
27+
std::string substr = newRoot.substr( start, end - start );
1628
if ( substr != pathSep )
1729
{
1830
output.push_back( substr );
1931
}
2032
}
2133
}
2234

23-
std::string substr = path.substr( start );
35+
std::string substr = newRoot.substr( start );
2436
if ( substr != pathSep && substr.length() > 0 )
2537
{
2638
output.push_back( substr );

Source/Platform/FilePosix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ bool Helium::MakePath( const char* path )
363363
{
364364
if ( stat( currentDirectory.c_str(), &status ) != 0 )
365365
{
366-
if ( !mkdir( currentDirectory.c_str(), 0777 ) )
366+
if ( mkdir( currentDirectory.c_str(), 0777 ) != 0 )
367367
{
368368
if ( errno != EEXIST )
369369
{
@@ -454,5 +454,5 @@ bool Helium::Move( const char* source, const char* dest )
454454

455455
bool Helium::Delete( const char* path )
456456
{
457-
return unlink( path ) != 0;
457+
return unlink( path ) == 0;
458458
}

0 commit comments

Comments
 (0)