Skip to content

add file_exists(path) #5215

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
merged 2 commits into from
Feb 21, 2020
Merged

add file_exists(path) #5215

merged 2 commits into from
Feb 21, 2020

Conversation

kroening
Copy link
Member

@kroening kroening commented Jan 25, 2020

This offers the obvious wrapper around the OS-specific access() and remove/unlink functions, to be used until we switch to C++17.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

This offers the obvious wrapper around the OS-specific access() function, to
be used until we switch to C++17.
@kroening kroening force-pushed the file-exists branch 2 times, most recently from aac2283 to ecba483 Compare January 25, 2020 14:59
Added file_remove, the obvious wrapper around the OS-specific unlink.
This will be replaced by std::filesystem::remove once we have C++17.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, I guess this code is already plenty exercised by existing tests?

@@ -124,8 +125,8 @@ int hybrid_binary(
}

// delete the goto binary
int remove_result = remove(goto_binary_file.c_str());
if(remove_result != 0)
bool remove_result = file_remove(goto_binary_file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏ const

@@ -64,8 +65,8 @@ int hybrid_binary(
}

// delete the goto binary
int remove_result = remove(goto_binary_file.c_str());
if(remove_result != 0)
bool remove_result = file_remove(goto_binary_file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏ const

Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible. I concur with Peter's nit picks about const but nothing blocking.

@kroening kroening merged commit ac74e68 into develop Feb 21, 2020
@kroening kroening deleted the file-exists branch February 21, 2020 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants