Limit length of filenames (#311)

* Limit length of filenames

If whipper generated filenames are longer thant the maximum value supported by the filesystem, the I/O operations are going to fail.
With this commit filenames which may be too long are truncated to the maximum allowable length.

Fixes #197.
This commit is contained in:
JoeLametta
2018-10-22 20:51:14 +02:00
committed by GitHub
parent 669b356daa
commit 02fd962094
3 changed files with 20 additions and 5 deletions

View File

@@ -574,7 +574,7 @@ class Program:
return accurip.verify_result(self.result, responses, checksums)
def write_m3u(self, discname):
m3uPath = u'%s.m3u' % discname
m3uPath = common.truncate_filename(discname + '.m3u')
with open(m3uPath, 'w') as f:
f.write(u'#EXTM3U\n'.encode('utf-8'))
for track in self.result.tracks:
@@ -596,7 +596,7 @@ class Program:
def writeCue(self, discName):
assert self.result.table.canCue()
cuePath = '%s.cue' % discName
cuePath = common.truncate_filename(discName + '.cue')
logger.debug('write .cue file to %s', cuePath)
handle = open(cuePath, 'w')
# FIXME: do we always want utf-8 ?
@@ -608,7 +608,7 @@ class Program:
return cuePath
def writeLog(self, discName, logger):
logPath = '%s.log' % discName
logPath = common.truncate_filename(discName + '.log')
handle = open(logPath, 'w')
log = logger.log(self.result)
handle.write(log.encode('utf-8'))