Skip to content

Commit e365e70

Browse files
committed
cf grangier#13 - Fixes multiplatform paths
1 parent 2ac0154 commit e365e70

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

goose/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def initialize(self):
7474

7575
# test to write a dummy file to the directory
7676
# to check is directory is writtable
77-
# FIXEME : use os.path.join
78-
path = '%s/test.txt' % self.config.local_storage_path
77+
path = os.path.join(self.config.local_storage_path, 'test.txt')
7978
try:
8079
f = open(path, 'w')
8180
f.close()

goose/crawler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def get_extractor(self):
126126
return StandardContentExtractor(self.config)
127127

128128
def relase_resources(self, article):
129-
# FIXEME : use os.path.join
130-
path = '%s/%s_*' % (self.config.local_storage_path, article.link_hash)
129+
path = os.path.join(self.config.local_storage_path, '%s_*' % article.link_hash)
131130
for fname in glob.glob(path):
132131
try:
133132
os.remove(fname)

goose/images/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ def write_localfile(self, entity, link_hash, src, config):
103103
@classmethod
104104
def get_localfile_name(self, link_hash, src, config):
105105
image_hash = hashlib.md5(smart_str(src)).hexdigest()
106-
# FIXEME : use os.path.join
107-
return config.local_storage_path + "/" + link_hash + "_py_" + image_hash
106+
return os.path.join(config.local_storage_path, '%s_%s' % (link_hash, image_hash))
108107

109108
@classmethod
110109
def clean_src_string(self, src):

0 commit comments

Comments
 (0)