~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to tools/mkfat.py

  • Committer: Vojtech Horky
  • Date: 2012-05-23 12:03:26 UTC
  • mfrom: (1443.1.19 misc)
  • mto: This revision was merged to the branch mainline in revision 1479.
  • Revision ID: vojtechhorky@users.sourceforge.net-20120523120326-jv50stjymxmh598s
Merge GSOC-originated patches 

Merge from lp:~vojtech-horky/helenos/misc.

The merge includes:
 * Switching to previous directory with `cd -' in Bdsh
 * Interactive mode for cp module in Bdsh
 * Implementation of sleep command
 * printf and echo for Bdsh
 * Rewrite of the mkdir module
 * Ctrl-arrow jumps over words in the editor
 * The scripts work with Python 3

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
def fat_lchars(name):
189
189
        "Filter FAT legal characters"
190
190
        
191
 
        filtered_name = ''
 
191
        filtered_name = b''
192
192
        filtered = False
193
193
        
194
194
        for char in name.encode('ascii', 'replace').upper():
204
204
        "Create a 8.3 name for the given name"
205
205
        
206
206
        ascii_name, lfn = fat_lchars(name)
207
 
        ascii_parts = ascii_name.split('.')
 
207
        # Splitting works only on strings, not on bytes
 
208
        ascii_parts = ascii_name.decode('utf8').split('.')
208
209
        
209
210
        short_name = ''
210
211
        short_ext = ''
443
444
        
444
445
        extra_bytes = int(sys.argv[1])
445
446
        
446
 
        path = os.path.abspath(sys.argv[2].decode())
 
447
        path = os.path.abspath(sys.argv[2])
447
448
        if (not os.path.isdir(path)):
448
449
                print("<PATH> must be a directory")
449
450
                return