Skip to content

Commit

Permalink
Move createPath from Utilities.py to Myos.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian-DELRIEU committed Nov 23, 2021
1 parent ccb759b commit a01c56e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
27 changes: 22 additions & 5 deletions Myos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,27 @@ def goto_Onedrive():
os.chdir("D:/OneDrive/")

def OneDrive_path():
if TERMINAL == "MAC":
path = "/Users/floriandelrieu/OneDrive/"
elif TERMINAL == "PC":
path = "D:/OneDrive/"
return path
if TERMINAL == "MAC": return "/Users/floriandelrieu/OneDrive/"
elif TERMINAL == "PC": return "D:/OneDrive/"
else: return EnvironmentError , "Terminal not recognized"

def createPath(path):
path_list = []
current_path = os.getcwd()
Terminal = getOS()
##
if Terminal == "PC": separator = "\\"
elif Terminal == "MAC": separator = "/"
else: return EnvironmentError, "Wrong terminal"
##
if "/" in path: path_list = path.split("/")
elif "\\" in path: path_list = path.split("\\")
for el in path_list: # Garde uniquement les noms de dossiers
if ("/" or "\\" or "") in el: path_list.remove(el)
for i, el in enumerate(path_list):
try: os.mkdir(current_path+separator+el)
except: pass
finally:current_path += separator + el
return path_list

TERMINAL = getOS()
22 changes: 0 additions & 22 deletions Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,25 +170,3 @@ def rom2int(roman=str()):
number += 1
roman = roman.replace("I","",1)
return number

def createPath(path):
import Myos
import os
path_list = []
current_path = os.getcwd()
Terminal = Myos.getOS()
##
if Terminal == "PC": separator = "\\"
elif Terminal == "MAC": separator = "/"
else: return EnvironmentError, "Wrong terminal"
##
if "/" in path: path_list = path.split("/")
elif "\\" in path: path_list = path.split("\\")
for el in path_list: # Garde uniquement les noms de dossiers
if ("/" or "\\" or "") in el: path_list.remove(el)
for i, el in enumerate(path_list):
try: os.mkdir(current_path+separator+el)
except: pass
finally:current_path += separator + el

return path_list

0 comments on commit a01c56e

Please sign in to comment.