Rename os_agnostic.py to the more appropiate os_specifics

to encapsulate file system unique filename and path handling
This commit is contained in:
Roberto Rosario
2011-11-30 09:31:32 -04:00
parent d37b36bce3
commit a646997ab8

View File

@@ -0,0 +1,20 @@
import os
from document_indexing.conf.settings import SUFFIX_SEPARATOR
def assemble_suffixed_filename(filename, suffix=0):
'''
Split document filename, to attach suffix to the name part then
re attacht the extension
'''
if suffix:
name, extension = filename.split(os.split(os.extsep))
return SUFFIX_SEPARATOR.join([name, unicode(suffix), os.extsep, extension])
else:
return file_filename
def assemble_path_from_list(directory_list):
return os.sep.join(directory_list)