use FixPath on keep_dirs key - a path, as the backslashes in windows cause python errors

This commit is contained in:
2021-01-21 11:04:57 +11:00
parent 72a892fd17
commit a716ed6007

View File

@@ -371,7 +371,7 @@ def JobImportDir(job):
return
else:
dir=AddDir(job, os.path.basename(path[0:-1]), symlink, None )
keep_dirs[dir.path_prefix]=dir
keep_dirs[FixPath(dir.path_prefix)]=dir
import_dir=dir
fcnt[symlink]=0
files = sorted(glob.glob(path + '**', recursive=True))
@@ -386,15 +386,15 @@ def JobImportDir(job):
fname=file.replace(path, "")
stat = os.stat(file)
dirname=SymlinkName(path, file)
if stat.st_ctime > keep_dirs[dirname].last_import_date:
if stat.st_ctime > keep_dirs[FixPath(dirname)].last_import_date:
if DEBUG==1:
AddLogForJob(job, "DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
print("DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ) )
AddLogForJob(job, "DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file )
print("DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ) )
if os.path.isdir(file):
path_prefix=os.path.join(symlink,fname)
dir=AddDir( job, fname, path_prefix, dir )
fcnt[path_prefix]=0
keep_dirs[dir.path_prefix]=dir
keep_dirs[FixPath(dir.path_prefix)]=dir
else:
overall_file_cnt=overall_file_cnt+1
dirname=SymlinkName(path, file)
@@ -409,8 +409,8 @@ def JobImportDir(job):
e=AddFile( job, os.path.basename(fname), type_str, fsize, dir )
else:
if DEBUG==1:
AddLogForJob(job, "DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
print("DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
AddLogForJob(job, "DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file )
print("DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file )
FinishJob(job, "Finished Importing: {} - Found {} new files".format( path, overall_file_cnt ) )
for d in keep_dirs:
keep_dirs[d].num_files = fcnt[d]