-
Notifications
You must be signed in to change notification settings - Fork 0
/
ofs-srctobin.py
executable file
·57 lines (45 loc) · 1.76 KB
/
ofs-srctobin.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
#!/usr/bin/env python3
###
# This file is part of Ottd File scripts (OFS).
#
# OFS is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# OFS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.
#
# See the GNU General Public License for more details. You should have received
# a copy of the GNU General Public License along with OFS. If not, see
# <http://www.gnu.org/licenses/>.
###
# directory where you keep the svn checkout. This should be identical to the one
# in ofs-svnupdate.py
sourcedir = '../'
# directory where you keep the running server. Ideally this is where you keep your
# ofs-scripts. Ofs-svnupdate will copy the sourcedir/bundle contents over to this
# directory.
gamedir = './'
# -------------------- DO NOT EDIT ANYTHING BELOW THIS LINE --------------------
from distutils.dir_util import copy_tree, DistutilsFileError
import os, os.path
from sys import exit
def main():
ReturnValues = assignReturnValues()
# set current working directory to wherever ofs-svntobin is located in case of relative paths
os.chdir(os.path.dirname(os.path.abspath(__file__)))
sourcefiles = os.path.join(sourcedir, 'bundle/')
try:
copy_tree(sourcefiles, gamedir, verbose=1)
except DistutilsFileError as e:
print(str(e))
exit(ReturnValues.get('FAILURE'))
def assignReturnValues():
values = {
'SUCCESS' : 0x00, # Files copied succesfully
'FAILURE' : 0x01, # Something went wrong, see output for details
}
return values
if __name__ == '__main__':
main()