-
Notifications
You must be signed in to change notification settings - Fork 260
Need to return to working directory after checking if path exists #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
RemiArnaud
merged 2 commits into
KhronosGroup:master
from
lasalvavida:create-directory-recursive
Oct 18, 2018
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,7 +205,7 @@ namespace COLLADABU | |
| start = text.find_first_not_of(separators, stop+1); | ||
| } | ||
| } | ||
|
|
||
| #ifdef COLLADABU_OS_WIN | ||
| //-------------------------------- | ||
| bool Utils::createDirectoryIfNeeded( const WideString &pathString ) | ||
|
|
@@ -232,7 +232,7 @@ namespace COLLADABU | |
|
|
||
| } | ||
| #endif | ||
|
|
||
| //-------------------------------- | ||
| bool Utils::createDirectoryIfNeeded( const String &pathString ) | ||
| { | ||
|
|
@@ -298,12 +298,14 @@ namespace COLLADABU | |
| for (std::list<WideString>::const_iterator iPath = paths.begin(); iPath != paths.end(); ++iPath) | ||
| { | ||
| // if path exists | ||
| if (_wchdir((*iPath).c_str()) == 0) | ||
| if (_wchdir((*iPath).c_str()) == 0) { | ||
| _wchdir(currentPath); | ||
| continue; | ||
| } | ||
|
|
||
| // path does not exist, try to create it | ||
| _wmkdir((*iPath).c_str()); | ||
|
|
||
| if (_wchdir((*iPath).c_str()) != 0) | ||
| { | ||
| pathExists = false; | ||
|
|
@@ -316,7 +318,7 @@ namespace COLLADABU | |
| return pathExists; | ||
| } | ||
| #endif | ||
|
|
||
| //-------------------------------- | ||
| bool Utils::createDirectoryRecursive( const String &pathString ) | ||
| { | ||
|
|
@@ -349,12 +351,14 @@ namespace COLLADABU | |
| for (std::list<String>::const_iterator iPath = paths.begin(); iPath != paths.end(); ++iPath) | ||
| { | ||
| // if path exists | ||
| if (_chdir((*iPath).c_str()) == 0) | ||
| if (_chdir((*iPath).c_str()) == 0) { | ||
| _chdir(currentPath); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please adopt original indentation, put a few tabs to align this statement |
||
| continue; | ||
| } | ||
|
|
||
| // path does not exist, try to create it | ||
| _mkdir((*iPath).c_str()); | ||
|
|
||
| if (_chdir((*iPath).c_str()) != 0) | ||
| { | ||
| pathExists = false; | ||
|
|
@@ -378,7 +382,7 @@ namespace COLLADABU | |
|
|
||
| // path does not exist, try to create it | ||
| mkdir((*iPath).c_str(), 0755); | ||
|
|
||
| if (chdir((*iPath).c_str()) != 0) | ||
| { | ||
| pathExists = false; | ||
|
|
@@ -391,7 +395,7 @@ namespace COLLADABU | |
| #endif | ||
| return pathExists; | ||
| } | ||
|
|
||
| #ifdef COLLADABU_OS_WIN | ||
| //-------------------------------- | ||
| bool Utils::directoryExists( const WideString &pathString ) | ||
|
|
@@ -412,7 +416,7 @@ namespace COLLADABU | |
|
|
||
| } | ||
| #endif | ||
|
|
||
| //-------------------------------- | ||
| bool Utils::directoryExists( const String &pathString ) | ||
| { | ||
|
|
@@ -437,7 +441,7 @@ namespace COLLADABU | |
| struct stat st; | ||
| if(stat(pathString.c_str(),&st) == 0) | ||
| pathExists = true; | ||
|
|
||
| #endif | ||
|
|
||
| return pathExists; | ||
|
|
@@ -471,8 +475,8 @@ namespace COLLADABU | |
| size_t length = strlen(command); | ||
| if( length > 4096) | ||
| return false; | ||
|
|
||
|
|
||
| int status = system(command); | ||
| copystatus = (status == 0 ? true : false); | ||
| #endif | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please align with tabs