mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
copy2->copyfile
copy2() will throw an OSError on Linux+fat32 partitions, and we don't really need the original mode bits or stat data anyway.
This commit is contained in:
parent
ae3e775fdd
commit
68da292ddb
2 changed files with 4 additions and 5 deletions
|
@ -98,8 +98,7 @@ def _buildImg(col, latex, fname, model):
|
||||||
stdout=log, stderr=log):
|
stdout=log, stderr=log):
|
||||||
return _errMsg("dvipng")
|
return _errMsg("dvipng")
|
||||||
# add to media
|
# add to media
|
||||||
shutil.copy2(png,
|
shutil.copyfile(png, os.path.join(mdir, fname))
|
||||||
os.path.join(mdir, fname))
|
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
os.chdir(oldcwd)
|
os.chdir(oldcwd)
|
||||||
|
|
|
@ -69,7 +69,7 @@ If the same name exists, compare checksums."""
|
||||||
dst = os.path.join(mdir, base)
|
dst = os.path.join(mdir, base)
|
||||||
# if it doesn't exist, copy it directly
|
# if it doesn't exist, copy it directly
|
||||||
if not os.path.exists(dst):
|
if not os.path.exists(dst):
|
||||||
shutil.copy2(opath, dst)
|
shutil.copyfile(opath, dst)
|
||||||
return base
|
return base
|
||||||
# if it's identical, reuse
|
# if it's identical, reuse
|
||||||
if self.filesIdentical(opath, dst):
|
if self.filesIdentical(opath, dst):
|
||||||
|
@ -89,7 +89,7 @@ If the same name exists, compare checksums."""
|
||||||
else:
|
else:
|
||||||
root = re.sub(reg, repl, root)
|
root = re.sub(reg, repl, root)
|
||||||
# copy and return
|
# copy and return
|
||||||
shutil.copy2(opath, path)
|
shutil.copyfile(opath, path)
|
||||||
return os.path.basename(os.path.basename(path))
|
return os.path.basename(os.path.basename(path))
|
||||||
|
|
||||||
def filesIdentical(self, path1, path2):
|
def filesIdentical(self, path1, path2):
|
||||||
|
@ -192,7 +192,7 @@ If the same name exists, compare checksums."""
|
||||||
src = os.path.join(ldir, f)
|
src = os.path.join(ldir, f)
|
||||||
dst = os.path.join(rdir, f)
|
dst = os.path.join(rdir, f)
|
||||||
if not os.path.exists(dst):
|
if not os.path.exists(dst):
|
||||||
shutil.copy2(src, dst)
|
shutil.copyfile(src, dst)
|
||||||
cnt += 1
|
cnt += 1
|
||||||
return cnt
|
return cnt
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue