forked from berndw1960/creategmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeep_data.py
More file actions
executable file
·58 lines (43 loc) · 1.06 KB
/
keep_data.py
File metadata and controls
executable file
·58 lines (43 loc) · 1.06 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
keep_data on/off
no options - no harm
"""
import os
import sys
WORK_DIR = (os.environ['HOME'] + "/map_build/")
def printinfo(msg):
print(("II: " + msg))
def printwarning(msg):
print(("WW: " + msg))
def printerror(msg):
print(("EE: " + msg))
def is_there(find, solutionhint):
"""
test if a file or dir can be found at a predefined place
raise message if fails and returns 1
on success return 0
"""
ExitCode = os.path.exists(find)
if ExitCode == True:
printinfo(find + " found")
else:
printerror(find + " not found")
print(solutionhint)
quit()
hint = ("mkdir " + (WORK_DIR))
is_there((WORK_DIR), hint)
os.chdir(WORK_DIR)
ExitCode = os.path.exists("keep_data.lck")
if ExitCode == True:
os.remove("keep_data.lck")
ExitCode2 = os.path.exists((WORK_DIR) + "no_split.lck")
if ExitCode2 == True:
os.remove("no_split.lck")
printinfo("keep_data switched off!")
else:
datei = open("keep_data.lck", "w")
datei.close()
printinfo("keep_data switched on!")
quit()