X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fcreate_resources.py;h=69d9e7d303787daa24c092387ac80c82ecb994b4;hb=9460d9624a5cf24126bc39605bc47d43330fcdf4;hp=1e346fb9b9cf8859a615afc0d6b5fa269cd5d810;hpb=d31bb1427aa1f9a0e98c8e7aaacc0d75e3252649;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/create_resources.py b/gtk/src/create_resources.py index 1e346fb9..69d9e7d3 100644 --- a/gtk/src/create_resources.py +++ b/gtk/src/create_resources.py @@ -36,8 +36,8 @@ def start_element_handler(tag, attr): val = dict() stack.append(val) elif tag == "icon": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: val = dict() @@ -49,15 +49,21 @@ def start_element_handler(tag, attr): val["height"] = pb.get_height() val["rowstride"] = pb.get_rowstride() val["data"] = plistlib.Data(pb.get_pixels()) + elif fname == None: + print >> sys.stderr, ( "Error: No such icon file %s" % fbase ) + sys.exit(1) elif tag == "plist": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: val = plistlib.readPlist(fname) + elif fname == None: + print >> sys.stderr, ( "Error: No such plist file %s" % fbase ) + sys.exit(1) elif tag == "string": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: try: @@ -65,6 +71,10 @@ def start_element_handler(tag, attr): val = ff.read() except Exception, err: print >> sys.stderr, ( "Error: %s" % str(err) ) + sys.exit(1) + elif fname == None: + print >> sys.stderr, ( "Error: No such string file %s" % fbase ) + sys.exit(1) if val != None: if type(current) == types.DictType: @@ -101,7 +111,7 @@ def find_file(name): global inc_list for inc_dir in inc_list: - inc = "%s/%s" % inc_dir, name + inc = "%s/%s" % (inc_dir, name) if os.path.isfile(inc): return inc @@ -138,12 +148,6 @@ def main(): print >> sys.stderr, ( "Error: %s" % str(err) ) sys.exit(1) - try: - infile = open(args[0]) - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err) ) - sys.exit(1) - if len(args) > 1: try: outfile = open(args[1], "w")