Make mash more portable
This commit is contained in:
parent
458ecb5c1a
commit
9156da688d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.history.mash
|
7
main.py
7
main.py
|
@ -11,12 +11,13 @@ from os.path import expanduser
|
||||||
|
|
||||||
# Some initial variables
|
# Some initial variables
|
||||||
user = os.getlogin()
|
user = os.getlogin()
|
||||||
|
mashLocation = os.getcwd() + "/"
|
||||||
initDirectory = expanduser("~")
|
initDirectory = expanduser("~")
|
||||||
argList = ["", ""]
|
argList = ["", ""]
|
||||||
|
|
||||||
# Start work on checking whether a config file exists
|
# Start work on checking whether a config file exists
|
||||||
if os.path.isfile(expanduser("~") + "/.config/mash/mash.conf") == False:
|
if os.path.isfile(expanduser("~") + "/.config/mash/mash.conf") == False:
|
||||||
configFilePath = "/etc/mash/mash.conf"
|
configFilePath = mashLocation + "mash.conf"
|
||||||
else:
|
else:
|
||||||
configFilePath = (expanduser("~") + "/.config/mash/mash.conf")
|
configFilePath = (expanduser("~") + "/.config/mash/mash.conf")
|
||||||
# Parse config file, adding variables
|
# Parse config file, adding variables
|
||||||
|
@ -85,7 +86,7 @@ for word in confArgList:
|
||||||
elif word == 'lblue':
|
elif word == 'lblue':
|
||||||
colourCodes.append('\033[14m')
|
colourCodes.append('\033[14m')
|
||||||
# Write the time to the history file
|
# Write the time to the history file
|
||||||
historyFile = open((expanduser("~") + "/.history.mash"), "a")
|
historyFile = open((mashLocation + "/.history.mash"), "a")
|
||||||
historyFile.write("\n")
|
historyFile.write("\n")
|
||||||
historyFile.write(("Session on " + str(datetime.now())))
|
historyFile.write(("Session on " + str(datetime.now())))
|
||||||
historyFile.write("\n")
|
historyFile.write("\n")
|
||||||
|
@ -189,7 +190,7 @@ def mainLoop(startDir):
|
||||||
print("Command", command, "either doesn't exist, isn't in the path or isn't in this directory.")
|
print("Command", command, "either doesn't exist, isn't in the path or isn't in this directory.")
|
||||||
|
|
||||||
# Write to the history file
|
# Write to the history file
|
||||||
historyFile = open((expanduser("~") + "/.history.mash"), "a")
|
historyFile = open((mashLocation + "/.history.mash"), "a")
|
||||||
historyFile.write(command)
|
historyFile.write(command)
|
||||||
historyFile.write("\n")
|
historyFile.write("\n")
|
||||||
historyFile.close()
|
historyFile.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user