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

Don't arbitrarily delete extra files in project folder, allow images in project folder #788

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
11 changes: 3 additions & 8 deletions manuskript/load_save/version_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,6 @@ def saveProject(zip=None):

# Removing phantoms
for path in [p for p in cache if p not in [p for p, c in files]]:
filename = os.path.join(dir, folder, path)
log("* Removing", path)

if os.path.isdir(filename):
shutil.rmtree(filename)

else: # elif os.path.exists(filename)
os.remove(filename)

# Clear cache
cache.pop(path, 0)
Expand Down Expand Up @@ -663,6 +655,9 @@ def loadProject(project, zip=None):
if f[-4:] in [".xml", "opml"]:
with open(os.path.join(dirpath, f), "rb") as fo:
files[os.path.join(p, f)] = fo.read()
elif f[-4:] in [".png", "jpeg",".jpg","bmp","tiff",".gif",".pdf"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should by configurable, I use often SVG images.

Also HTML Files often with research information or other filetypes. (bst -> bibtex and so on)

In the moment I store my Images in folder on the same level as the project-file (I do not us the zip/one-file mode!)... So I don't have this Problem.

# ignore file
pass
else:
with open(os.path.join(dirpath, f), "r", encoding="utf8") as fo:
files[os.path.join(p, f)] = fo.read()
Expand Down