Skip to content

Commit

Permalink
fixed cross platform compatibility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nrg12 committed Feb 8, 2017
1 parent 99958fc commit d27fd11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crawl_subject_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def copy_files(self, lst):
for tup in lst:
filepath = tup[0]
drive, localdir = os.path.splitdrive(filepath)
savepath = os.path.join(self.output_dir, os.path.normpath(os.path.dirname(localdir)).lstrip('\\'))
savepath = os.path.join(self.output_dir,os.path.normpath(os.path.dirname(localdir)).lstrip(r"\\").lstrip("/"))
try:
with open(savepath) as f: pass
except IOError as e:
Expand Down
4 changes: 2 additions & 2 deletions mirror_script/mirror_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def mirror_files(self, lst):
def mirror_files_to_csv(self, lst):
self.getSavePath()
x = self.save_filename
if not re.match("(.csv)$", self.save_filename):
if not x.endswith('.csv'):
x+=".csv"
with open(self.output_dir+'/'+x, 'a') as f:
writer = csv.writer(f)
Expand All @@ -131,7 +131,7 @@ def mirror_files_recursive(self, lst):
filepath = tup[0]
base_name = os.path.basename(filepath)
drive, localdir = os.path.splitdrive(filepath)
savepath = os.path.join(self.output_dir,os.path.normpath(os.path.dirname(localdir)).lstrip('\\'))
savepath = os.path.join(self.output_dir,os.path.normpath(os.path.dirname(localdir)).lstrip(r"\\").lstrip("/"))
try:
with open(savepath): pass
except IOError:
Expand Down

0 comments on commit d27fd11

Please sign in to comment.