mirror of
https://github.com/gryf/uc1541.git
synced 2026-02-02 19:55:46 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1346a2fcf8 | |||
| fa3efe5f9f |
37
uc1541
37
uc1541
@@ -50,6 +50,9 @@ 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
|
||||||
|
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
|
||||||
into d64 image.
|
into d64 image.
|
||||||
2.2 Fixed bug(?) with unusual sector end (marked as sector 0, not 255),
|
2.2 Fixed bug(?) with unusual sector end (marked as sector 0, not 255),
|
||||||
@@ -68,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-24
|
Date: 2012-10-15
|
||||||
Version: 2.3
|
Version: 2.5
|
||||||
Licence: BSD
|
Licence: BSD
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -156,6 +159,7 @@ class D64(object):
|
|||||||
self.next_sector = 0
|
self.next_sector = 0
|
||||||
self.next_track = None
|
self.next_track = None
|
||||||
self._dir_contents = []
|
self._dir_contents = []
|
||||||
|
self._already_done = []
|
||||||
|
|
||||||
def _map_filename(self, string):
|
def _map_filename(self, string):
|
||||||
"""
|
"""
|
||||||
@@ -172,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)
|
||||||
@@ -182,7 +190,11 @@ class D64(object):
|
|||||||
Return False if the chain ends, True otherwise
|
Return False if the chain ends, True otherwise
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.next_track == 0 and self.next_sector in (0, 255):
|
# Well, self.next_sector _should_ have value $FF, but apparently there
|
||||||
|
# are the cases where it is not, therefore checking for that will not
|
||||||
|
# be performed and value of $00 on the next track will end the
|
||||||
|
# directory
|
||||||
|
if self.next_track == 0:
|
||||||
LOG.debug("End of directory")
|
LOG.debug("End of directory")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -198,6 +210,15 @@ class D64(object):
|
|||||||
|
|
||||||
self.next_track = ord(self.current_sector_data[0])
|
self.next_track = ord(self.current_sector_data[0])
|
||||||
self.next_sector = ord(self.current_sector_data[1])
|
self.next_sector = ord(self.current_sector_data[1])
|
||||||
|
|
||||||
|
if (self.next_track, self.next_sector) in self._already_done:
|
||||||
|
# Just a failsafe. Endless loop is not what is expected.
|
||||||
|
LOG.debug("Loop in track/sector pointer at %d,%d",
|
||||||
|
self.next_track, self.next_sector)
|
||||||
|
self._already_done = []
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._already_done.append((self.next_track, self.next_sector))
|
||||||
LOG.debug("Next track: %s,%s", self.next_track, self.next_sector)
|
LOG.debug("Next track: %s,%s", self.next_track, self.next_sector)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -418,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 = "----------"
|
||||||
|
|||||||
Reference in New Issue
Block a user