|
|
@ -12,6 +12,7 @@ import re
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
|
|
|
|
import time
|
|
|
|
import shutil
|
|
|
|
import shutil
|
|
|
|
import string
|
|
|
|
import string
|
|
|
|
import _string
|
|
|
|
import _string
|
|
|
@ -19,6 +20,7 @@ import sqlite3
|
|
|
|
import datetime
|
|
|
|
import datetime
|
|
|
|
import operator
|
|
|
|
import operator
|
|
|
|
import itertools
|
|
|
|
import itertools
|
|
|
|
|
|
|
|
import email.utils
|
|
|
|
import urllib.parse
|
|
|
|
import urllib.parse
|
|
|
|
from . import text, exception
|
|
|
|
from . import text, exception
|
|
|
|
|
|
|
|
|
|
|
@ -613,17 +615,23 @@ class PathFormat():
|
|
|
|
os.unlink(self.temppath)
|
|
|
|
os.unlink(self.temppath)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if self.temppath == self.realpath:
|
|
|
|
if self.temppath != self.realpath:
|
|
|
|
return
|
|
|
|
# move temp file to its actual location
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
os.replace(self.temppath, self.realpath)
|
|
|
|
os.replace(self.temppath, self.realpath)
|
|
|
|
except OSError:
|
|
|
|
return
|
|
|
|
shutil.copyfile(self.temppath, self.realpath)
|
|
|
|
except OSError:
|
|
|
|
os.unlink(self.temppath)
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shutil.copyfile(self.temppath, self.realpath)
|
|
|
|
if "_filetime" in self.keywords:
|
|
|
|
os.unlink(self.temppath)
|
|
|
|
# try to set file times
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
filetime = email.utils.mktime_tz(email.utils.parsedate_tz(
|
|
|
|
|
|
|
|
self.keywords["_filetime"]))
|
|
|
|
|
|
|
|
if filetime:
|
|
|
|
|
|
|
|
os.utime(self.realpath, (time.time(), filetime))
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def adjust_path(path):
|
|
|
|
def adjust_path(path):
|
|
|
|