Compare commits

..

1 Commits

Author SHA1 Message Date
Maxwell Jeffress
9156da688d Make mash more portable 2024-08-28 14:58:29 +10:00
3 changed files with 5 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.history.mash

View File

@ -11,12 +11,13 @@ from os.path import expanduser
# Some initial variables
user = os.getlogin()
mashLocation = os.getcwd() + "/"
initDirectory = expanduser("~")
argList = ["", ""]
# Start work on checking whether a config file exists
if os.path.isfile(expanduser("~") + "/.config/mash/mash.conf") == False:
configFilePath = "/etc/mash/mash.conf"
configFilePath = mashLocation + "mash.conf"
else:
configFilePath = (expanduser("~") + "/.config/mash/mash.conf")
# Parse config file, adding variables
@ -85,7 +86,7 @@ for word in confArgList:
elif word == 'lblue':
colourCodes.append('\033[14m')
# Write the time to the history file
historyFile = open((expanduser("~") + "/.history.mash"), "a")
historyFile = open((mashLocation + "/.history.mash"), "a")
historyFile.write("\n")
historyFile.write(("Session on " + str(datetime.now())))
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.")
# Write to the history file
historyFile = open((expanduser("~") + "/.history.mash"), "a")
historyFile = open((mashLocation + "/.history.mash"), "a")
historyFile.write(command)
historyFile.write("\n")
historyFile.close()