Преглед изворни кода

[changed] txtsplit and txtmerge to add and read qsrc extension.

3xpurt пре 6 година
родитељ
комит
7ac859bf98
3 измењених фајлова са 5 додато и 5 уклоњено
  1. 1 1
      txtmerge.py
  2. 2 2
      txtsplit.py
  3. 2 2
      txtsplit3.py

+ 1 - 1
txtmerge.py

@@ -25,7 +25,7 @@ for location in root.iter('Location'):
     iname = iname.replace("$","_")
 
     try:
-        ifile = io.open(os.path.join(idir,iname), 'rt', encoding='utf-8')
+        ifile = io.open(os.path.join(idir,iname + '.qsrc'), 'rt', encoding='utf-8')
         text = ifile.read()
 
         # make sure there's a line at the end of file

+ 2 - 2
txtsplit.py

@@ -28,7 +28,7 @@ oname = None
 firstline = ifile.readline().replace(u'\ufeff','')
 match = re.search(ur'^#\s(\$?[_.\w]+)$', firstline)
 if match:
-    oname = os.path.join(odir, match.group(1).replace("$","_") )
+    oname = os.path.join(odir, match.group(1).replace("$","_") + '.qsrc' )
     counter += 1
 assert oname, "file is in the wrong format, must start with a location name"
 
@@ -39,7 +39,7 @@ for line in ifile:
     match = re.search(ur'^#\s(\$?[_.\w]+)$', line)
     if match:
         ofile.close()
-        oname = os.path.join(odir, match.group(1).replace("$","_") )
+        oname = os.path.join(odir, match.group(1).replace("$","_") + '.qsrc' )
         counter += 1
         ofile = io.open(oname, 'w', encoding='utf-8')
     ofile.write(line)

+ 2 - 2
txtsplit3.py

@@ -28,7 +28,7 @@ oname = None
 firstline = ifile.readline().replace(u'\ufeff','')
 match = re.search('^#\s(\$?[_.\w]+)$', firstline)
 if match:
-    oname = os.path.join(odir, match.group(1).replace("$","_") )
+    oname = os.path.join(odir, match.group(1).replace("$","_") + '.qsrc' )
     counter += 1
 assert oname, "file is in the wrong format, must start with a location name"
 
@@ -39,7 +39,7 @@ for line in ifile:
     match = re.search('^#\s(\$?[_.\w]+)$', line)
     if match:
         ofile.close()
-        oname = os.path.join(odir, match.group(1).replace("$","_") )
+        oname = os.path.join(odir, match.group(1).replace("$","_") + '.qsrc' )
         counter += 1
         ofile = io.open(oname, 'w', encoding='utf-8')
     ofile.write(line)