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
[internal] Schedule:File relative paths mod #5010
Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5111,7 +5111,9 @@ OS:Schedule:File, | |
\key Yes | ||
\key No | ||
\default Yes | ||
A8; \field Translate File Name | ||
A8; \field Translate File With Relative Path | ||
\note "No" means the absolute path of the ExternalFile is resolved and translated to IDF. | ||
\note "Yes" means only the filename (relative) is translated | ||
Comment on lines
+5115
to
+5116
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. 👍 |
||
\type choice | ||
\default No | ||
\key Yes | ||
|
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -233,14 +233,14 @@ namespace model { | |
return csvFile; | ||
} | ||
|
||
bool ScheduleFile_Impl::translateFileName() const { | ||
boost::optional<std::string> value = getString(OS_Schedule_FileFields::TranslateFileName, true); | ||
bool ScheduleFile_Impl::translateFileWithRelativePath() const { | ||
boost::optional<std::string> value = getString(OS_Schedule_FileFields::TranslateFileWithRelativePath, true); | ||
OS_ASSERT(value); | ||
return openstudio::istringEqual(value.get(), "Yes"); | ||
} | ||
|
||
bool ScheduleFile_Impl::isTranslateFileNameDefaulted() const { | ||
return isEmpty(OS_Schedule_FileFields::TranslateFileName); | ||
bool ScheduleFile_Impl::isTranslateFileWithRelativePathDefaulted() const { | ||
return isEmpty(OS_Schedule_FileFields::TranslateFileWithRelativePath); | ||
} | ||
|
||
/* FIXME! | ||
|
@@ -386,22 +386,36 @@ namespace model { | |
}*/ | ||
} | ||
|
||
bool ScheduleFile_Impl::setTranslateFileName(bool translateFileName) { | ||
bool ScheduleFile_Impl::setTranslateFileWithRelativePath(bool translateFileWithRelativePath) { | ||
bool result = false; | ||
if (translateFileName) { | ||
result = setString(OS_Schedule_FileFields::TranslateFileName, "Yes"); | ||
if (translateFileWithRelativePath) { | ||
result = setString(OS_Schedule_FileFields::TranslateFileWithRelativePath, "Yes"); | ||
} else { | ||
result = setString(OS_Schedule_FileFields::TranslateFileName, "No"); | ||
result = setString(OS_Schedule_FileFields::TranslateFileWithRelativePath, "No"); | ||
} | ||
OS_ASSERT(result); | ||
return result; | ||
} | ||
|
||
void ScheduleFile_Impl::resetTranslateFileName() { | ||
const bool result = setString(OS_Schedule_FileFields::TranslateFileName, ""); | ||
void ScheduleFile_Impl::resetTranslateFileWithRelativePath() { | ||
const bool result = setString(OS_Schedule_FileFields::TranslateFileWithRelativePath, ""); | ||
OS_ASSERT(result); | ||
} | ||
|
||
openstudio::path ScheduleFile_Impl::translatedFilePath() const { | ||
if (translateFileWithRelativePath()) { | ||
return toPath(externalFile().fileName()); | ||
} | ||
openstudio::path filePath = externalFile().filePath(); | ||
if (!exists(filePath)) { | ||
LOG(Warn, "Cannot find file \"" << filePath << "\""); | ||
} else { | ||
// make the path correct for this system | ||
filePath = system_complete(filePath); | ||
} | ||
return filePath; | ||
} | ||
Comment on lines
+405
to
+417
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. 👍 |
||
|
||
} // namespace detail | ||
|
||
ScheduleFile::ScheduleFile(const ExternalFile& externalfile, int column, int rowsToSkip) | ||
|
@@ -503,12 +517,12 @@ namespace model { | |
return getImpl<detail::ScheduleFile_Impl>()->csvFile(); | ||
} | ||
|
||
bool ScheduleFile::translateFileName() const { | ||
return getImpl<detail::ScheduleFile_Impl>()->translateFileName(); | ||
bool ScheduleFile::translateFileWithRelativePath() const { | ||
return getImpl<detail::ScheduleFile_Impl>()->translateFileWithRelativePath(); | ||
} | ||
|
||
bool ScheduleFile::isTranslateFileNameDefaulted() const { | ||
return getImpl<detail::ScheduleFile_Impl>()->isTranslateFileNameDefaulted(); | ||
bool ScheduleFile::isTranslateFileWithRelativePathDefaulted() const { | ||
return getImpl<detail::ScheduleFile_Impl>()->isTranslateFileWithRelativePathDefaulted(); | ||
} | ||
|
||
/* FIXME! | ||
|
@@ -585,12 +599,16 @@ unsigned ScheduleFile::addTimeSeries(const openstudio::TimeSeries& timeSeries) { | |
getImpl<detail::ScheduleFile_Impl>()->resetAdjustScheduleforDaylightSavings(); | ||
} | ||
|
||
bool ScheduleFile::setTranslateFileName(bool translateFileName) { | ||
return getImpl<detail::ScheduleFile_Impl>()->setTranslateFileName(translateFileName); | ||
bool ScheduleFile::setTranslateFileWithRelativePath(bool translateFileWithRelativePath) { | ||
return getImpl<detail::ScheduleFile_Impl>()->setTranslateFileWithRelativePath(translateFileWithRelativePath); | ||
} | ||
|
||
void ScheduleFile::resetTranslateFileWithRelativePath() { | ||
getImpl<detail::ScheduleFile_Impl>()->resetTranslateFileWithRelativePath(); | ||
} | ||
|
||
void ScheduleFile::resetTranslateFileName() { | ||
getImpl<detail::ScheduleFile_Impl>()->resetTranslateFileName(); | ||
openstudio::path ScheduleFile::translatedFilePath() const { | ||
return getImpl<detail::ScheduleFile_Impl>()->translatedFilePath(); | ||
} | ||
|
||
/// @cond | ||
|
This file contains 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
This file contains 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
This file contains 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
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.
Yes, this name more clear.