This repository has been archived by the owner on May 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
release_wormhol.py
72 lines (54 loc) · 2.02 KB
/
release_wormhol.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This Python 2.6 script extract useful files for a standalone Msgdll app
# release wormhol
from shutil import *
import os
import glob
source_folder = "D:/adinpsz/d/wormhol/"
destination_folder = "D:/adinpsz/d/wormhol/release/"
print "Deleting " + destination_folder
rmtree(destination_folder, True) # ignore errors
def createDir(dirname):
try:
print "Creating filder " + dirname
os.makedirs(dirname)
except OSError:
if os.path.exists(dirname):
# We are nearly safe
pass
else:
# There was an error on creation, so make sure we know about it
raise
createDir(destination_folder)
createDir(destination_folder + "data/")
createDir(destination_folder + "data/shaders")
createDir(destination_folder + "data/gfx/")
createDir(destination_folder + "data/music/")
createDir(destination_folder + "data/fx/")
def outputFiles(source_dir, dest_dir, filename_with_wildcards):
def outputFile(source_dir, dest_dir, filename):
src = source_folder + source_dir + filename
dst = destination_folder + dest_dir + filename
print "Copying " + src + " to " + dst
copyfile(filename, dst)
return
def find(filename_with_wildcards):
s = glob.glob(filename_with_wildcards)
if len(s) == 0:
print "WARNING: no file found for " + filename_with_wildcards
print "supposedly in '" + source_dir + "'\n"
# exit(1)
return s
os.chdir(source_folder + source_dir)
filenames = find(filename_with_wildcards);
for f in filenames:
outputFile(source_dir, dest_dir, f)
outputFiles("", "", "data/shaders/*.fs")
outputFiles("", "", "data/shaders/*.vs")
outputFiles("", "", "data/music/*.mp3")
outputFiles("", "", "data/fx/*.wav")
outputFiles("", "", "data/icon.bmp")
outputFiles("", "", "data/gfx/*.png")
outputFiles("", "", "data/gfx/*.jpg")
outputFiles("", "", "wormhol.exe")
outputFiles("", "", "wormhol.nfo")
outputFiles("", "", "*.dll")