Skip to content
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

Fix file name in path returned by getAbsolutePath when a directory is not provided #8330

Merged
merged 2 commits into from
Nov 2, 2020

Conversation

nealkruis
Copy link
Member

Pull request overview

This fixes getAbsolutePath for two scenarios:

  1. When a file was specified in the current working directory (e.g., with no directory prefixes), the file name returned in the path had the first two characters stripped off. E.g.:

    getAbsolutePath("FileSystemTest.idf") = "/Path/to/cwd/leSystemTest.idf"
    
  2. After an initial fix for (1), I noticed:

    getAbsolutePath("./FileSystemTest.idf") = "/Path/to/cwd/./FileSystemTest.idf"
    

This pull requests includes unit tests for both of these situations and they now both come out correctly:

"/Path/to/cwd/FileSystemTest.idf"

The fix and unit tests use the platform independent value of DataStringGlobals::pathChar.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts

@nealkruis nealkruis added Defect Includes code to repair a defect in EnergyPlus DoNotPublish Includes changes that shouldn't be reported in the changelog NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Oct 2, 2020
@nealkruis nealkruis added this to the EnergyPlus Future milestone Oct 2, 2020
@nealkruis nealkruis requested a review from Myoldmopar October 2, 2020 16:28
@nealkruis nealkruis self-assigned this Oct 2, 2020
@nrel-bot-2
Copy link

@nealkruis @lgentile it has been 28 days since this pull request was last updated.

@mitchute
Copy link
Collaborator

mitchute commented Nov 2, 2020

@nealkruis this looks good. I ran tests locally and it all looked OK. Merging.

@mitchute mitchute merged commit fa7ed01 into NREL:develop Nov 2, 2020
@nealkruis nealkruis deleted the fix-absolute-path branch November 2, 2020 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus DoNotPublish Includes changes that shouldn't be reported in the changelog NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getAbsolutePath strips characters from the file name
7 participants