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

Windows fixes #81

Merged
merged 3 commits into from Oct 28, 2019
Merged

Windows fixes #81

merged 3 commits into from Oct 28, 2019

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Oct 28, 2019

This PR fixes three issues with running novelWriter on Windows, and one of the issues is general to all OSes.

  • Generating the initial config file now works also on Windows. It previously failed since the config location required two directories to be created, but the code assumed only one was needed.
  • On Windows, the Python open() command does not default to utf8, so all open statements now have encoding specified.
  • Failing to open a file that exists, caused novelWriter to report an error, but still internally tagged the file buffer as open and ready. This is what it usually does for files that do not exist (i.e. new file), so the open statement in that case returns an empty string from the file load function. However, since the file load function did not distinguish between new file and loading error, it would assume this holds for error as well, causing the file to be overwritten with an empty string on the next auto-save, on save, or on file close. Now, the loading function returns None in case of an error, and the document wrapper class as well as the editor GUI class then clears its internal settings as if no file was open at all. This prevents the overwrite.

@codecov-io
Copy link

codecov-io commented Oct 28, 2019

Codecov Report

Merging #81 into master will decrease coverage by 0.04%.
The diff coverage is 52.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
- Coverage    64.5%   64.45%   -0.05%     
==========================================
  Files          42       42              
  Lines        6319     6328       +9     
==========================================
+ Hits         4076     4079       +3     
- Misses       2243     2249       +6
Impacted Files Coverage Δ
nw/convert/file/latex.py 36.66% <0%> (ø) ⬆️
nw/convert/file/concat.py 32.55% <0%> (ø) ⬆️
nw/gui/sessionlog.py 12.96% <0%> (ø) ⬆️
nw/convert/file/markdown.py 47.82% <0%> (ø) ⬆️
nw/convert/file/text.py 24.5% <0%> (ø) ⬆️
nw/convert/file/html.py 25% <0%> (ø) ⬆️
nw/tools/optlaststate.py 53.03% <0%> (ø) ⬆️
nw/project/project.py 82.44% <100%> (ø) ⬆️
nw/project/index.py 89.51% <100%> (ø) ⬆️
nw/project/document.py 87.32% <50%> (-1.25%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98e136f...4fcff94. Read the comment docs.

@vkbo vkbo merged commit 32a785d into master Oct 28, 2019
@vkbo vkbo deleted the windows_fixes branch October 28, 2019 19:51
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.

None yet

2 participants