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

Remove uses of get_current_dir_name #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ int main(int argc, char** argv) {
if (tmp_base) {
temp_file::set_dir(args::get(tmp_base));
} else {
char* cwd = get_current_dir_name();
char cwd[512];
getcwd(cwd, sizeof(cwd));
temp_file::set_dir(std::string(cwd));
free(cwd);
}

temp_file::set_keep_temp(args::get(keep_temp_files));
Expand Down
4 changes: 2 additions & 2 deletions src/tempfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ namespace temp_file {

// Get the default temp dir from environment variables.
if (temp_dir.empty()) {
char* cwd = get_current_dir_name();
char cwd[512];
getcwd(cwd, sizeof(cwd));
temp_dir = std::string(cwd);
free(cwd);
/*const char *system_temp_dir = nullptr;
for (const char *var_name : {"TMPDIR", "TMP", "TEMP", "TEMPDIR", "USERPROFILE"}) {
if (system_temp_dir == nullptr) {
Expand Down