1
0
mirror of https://github.com/gryf/uc1541.git synced 2026-01-31 10:55:45 +01:00

Fixed bug with filenames started with a '-' sign.

This commit is contained in:
2012-10-16 15:50:05 +02:00
parent fa3efe5f9f
commit 1346a2fcf8

19
uc1541
View File

@@ -50,6 +50,7 @@ of error cause if any.
UC1541_HIDE_DEL - if set, no DEL entries will be shown UC1541_HIDE_DEL - if set, no DEL entries will be shown
Changelog: Changelog:
2.5 Fixed bug with filenames started with a '-' sign.
2.4 Fixed endless loop bug for reading directory in Python implemented 2.4 Fixed endless loop bug for reading directory in Python implemented
directory reader. directory reader.
2.3 Re added and missing method _correct_fname used for writing files 2.3 Re added and missing method _correct_fname used for writing files
@@ -70,8 +71,8 @@ Changelog:
1.0 Initial release 1.0 Initial release
Author: Roman 'gryf' Dobosz <gryf73@gmail.com> Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
Date: 2012-09-30 Date: 2012-10-15
Version: 2.4 Version: 2.5
Licence: BSD Licence: BSD
""" """
@@ -175,6 +176,10 @@ class D64(object):
character = D64.CHAR_MAP.get(ord(chr_), '?') character = D64.CHAR_MAP.get(ord(chr_), '?')
filename.append(character) filename.append(character)
# special cases
if filename[0] == "-":
filename[0] = "?"
LOG.debug("string: ``%s'' mapped to: ``%s''", string, LOG.debug("string: ``%s'' mapped to: ``%s''", string,
"".join(filename)) "".join(filename))
return "".join(filename) return "".join(filename)
@@ -434,9 +439,13 @@ class Uc1541(object):
if '/' in display_name: if '/' in display_name:
display_name = display_name.replace('/', '|') display_name = display_name.replace('/', '|')
# workaround for space at the beggining of the filename # workaround for space and dash at the beggining of the
if display_name[0] == ' ': # filename
display_name = '~' + display_name[1:] char_map = {' ': '~',
'-': '_'}
display_name = "".join([char_map.get(display_name[0],
display_name[0]),
display_name[1:]])
if ext == 'del': if ext == 'del':
perms = "----------" perms = "----------"