Skip to content

file.lua copy for windows #185

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
Apr 16, 2019
Merged

file.lua copy for windows #185

merged 2 commits into from
Apr 16, 2019

Conversation

supertobi
Copy link
Contributor

Could be improved, but at least it works for me.

@supertobi
Copy link
Contributor Author

@wpferguson Please test and merge if OK.

@wpferguson
Copy link
Member

I'll build a test suite for this and the other PR. Should have it done tonight.

if dtutils_file.check_if_bin_exists("cp") then
if dt.configuration.running_os == "windows" then
os.execute('copy "' .. fromFile .. '" "' .. toFile .. '"')
result = true
Copy link
Member

Choose a reason for hiding this comment

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

this should be result = os.execute also. It returns nil on failure and true on success, so we can use the windows copy command and if it fails for some reason then fall back to the pure lua copy solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@supertobi supertobi merged commit 0fe95e9 into master Apr 16, 2019
@supertobi supertobi deleted the file.lua branch April 16, 2019 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants