-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_opltran.py
44 lines (29 loc) · 828 Bytes
/
gen_opltran.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
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 2021
@author: martin
generates .TRN file for use by OPLTRAN command, run in DOSBOX
OPLTRAN @oplfiles [without .TRN extension] [-x] [-s/o/t]
[-x] - XP mode
[-s] - source only
[-o] - object only (default)
[-t] - source and object
e.g. OPTRAN @oplfiles -x -t
"""
import os
path = "alzan"
outfile = path + "\\oplfiles.TRN"
print("Filename is:", outfile)
with open(outfile,"w") as f_out: # open outfile for write
files = os.listdir(path)
out_files = []
for file in files:
n = file.find(".OPL")
if n > 0:
out_files.append(file[0:n])
n = file.find(".opl")
if n > 0:
out_files.append(file[0:n])
for file in out_files:
print(file)
f_out.write(file + "\n")