Skip to content

Commit

Permalink
When searching for the default base path for a scene file, ignore fil…
Browse files Browse the repository at this point in the history
…es on the network (http://, ftp://) since they are not on the local file system. Otherwise, the default base path will be empty. In the event all files are on the network, the base path will be the directory containing the scene file. Also, minor correction to text for Base Path What's This?.
  • Loading branch information
John Harwell committed Dec 28, 2017
1 parent d358687 commit 8fea6dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions src/Files/SceneFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -906,10 +906,15 @@ SceneFile::findBaseDirectoryForDataFiles() const
if (useNameFlag) {
const AString pathName = scenePathName->stringValue().trimmed();
if ( ! pathName.isEmpty()) {
FileInformation fileInfo(pathName);
const AString dirName = fileInfo.getAbsolutePath().trimmed();
if ( ! dirName.isEmpty()) {
directoryNames.insert(dirName);
/*
* Need to ignore file on the network
*/
if ( ! DataFile::isFileOnNetwork(pathName)) {
FileInformation fileInfo(pathName);
const AString dirName = fileInfo.getAbsolutePath().trimmed();
if ( ! dirName.isEmpty()) {
directoryNames.insert(dirName);
}
}
}
}
Expand All @@ -920,7 +925,12 @@ SceneFile::findBaseDirectoryForDataFiles() const

const std::vector<AString> stringVector(directoryNames.begin(),
directoryNames.end());
const AString baseDirectoryName = AString::findLongestCommonPrefix(stringVector);
AString baseDirectoryName = AString::findLongestCommonPrefix(stringVector);

if (baseDirectoryName.isEmpty()) {
FileInformation fileInfo(getFileName());
baseDirectoryName = fileInfo.getAbsolutePath();
}

return baseDirectoryName;
}
Expand Down
2 changes: 1 addition & 1 deletion src/GuiQt/SceneBasePathWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ SceneBasePathWidget::whatsThisBasePath()
{
const AString text("The Automatic Base Path is the \"lowest level\" path that contains the Scene File and "
"all data files referenced by the Scene File. "
"The directory structure of all files contained in the Scene File relative (at or below) "
"The directory structure of all files contained in the Scene File relative to (at or below) "
"the Base Path will be preserved in your dataset when it is downloaded from BALSA and "
"unzipped by other users. You may set a Custom path above the Automatic Base Path, but "
"it will add additional, unnecessary path layers to the unzipped dataset.");
Expand Down

0 comments on commit 8fea6dd

Please sign in to comment.