forked from tzlion/frogtool
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsf2000ROM.py
37 lines (32 loc) · 1.07 KB
/
sf2000ROM.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
class sf2000ROM():
ROMlocation = ""
ROMsecondaryFiles = []
title = ""
thumbnail = None
console = None
def __init__(self, location):
super().__init__()
# Check the file actually exists otherwise throw an error
if not os.path.isfile(location):
raise Exception
self.ROMlocation = location
self.title = os.path.splitext(os.path.basename(location))[0]
"""
Note that this will change the filename as well
"""
def setTitle(self, newTitle):
try:
ext = os.path.splitext(self.ROMlocation)[1]
newPath = os.path.join(os.path.dirname(self.ROMlocation),newTitle+ext)
os.rename(self.ROMlocation, newPath)
self.ROMlocation = newPath
self.title = newTitle
return True
except:
return False
def getFileSize(self):
if not os.path.isfile(self.ROMlocation):
raise Exception
return os.path.getsize(self.ROMlocation)
# TODO Add counting multiple files for ARCADE zips