~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to tools/mkfat.py

  • Committer: Vojtech Horky
  • Date: 2012-05-22 10:31:25 UTC
  • mto: (1460.2.42 mainline)
  • mto: This revision was merged to the branch mainline in revision 1479.
  • Revision ID: vojtechhorky@users.sourceforge.net-20120522103125-xy2p37couqxwhz09
Make tools work with Python 3 again

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