Make the file paths cross-platform compatible
This commit is contained in:
parent
87fd6ecd6e
commit
b01aa43f32
@ -54,7 +54,8 @@ class DataHandler:
|
|||||||
WARNING:-
|
WARNING:-
|
||||||
If this is the first time the app is opened, the user_name will be shown as wrong
|
If this is the first time the app is opened, the user_name will be shown as wrong
|
||||||
"""
|
"""
|
||||||
self.__file_path = appdirs.user_data_dir(appname="Unnamed_Password_Manager")
|
self.__file_path = appdirs.user_data_dir()
|
||||||
|
self.__file_path = path.join(self.__file_path, "Unnamed_Password_Manager")
|
||||||
self.__user_name = user_name
|
self.__user_name = user_name
|
||||||
self.__file_path = path.join(self.__file_path, self.__user_name)
|
self.__file_path = path.join(self.__file_path, self.__user_name)
|
||||||
self.__password = password
|
self.__password = password
|
||||||
@ -77,7 +78,8 @@ class DataHandler:
|
|||||||
If user_name exists, ValueError is thrown
|
If user_name exists, ValueError is thrown
|
||||||
"""
|
"""
|
||||||
file_path = path.join(
|
file_path = path.join(
|
||||||
appdirs.user_data_dir(appname="Unnamed_Password_Manager"),
|
appdirs.user_data_dir(),
|
||||||
|
"Unnamed_Password_Manager",
|
||||||
user_name
|
user_name
|
||||||
)
|
)
|
||||||
if path.exists(file_path):
|
if path.exists(file_path):
|
||||||
|
@ -10,7 +10,11 @@ app: Flask = Flask(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def handle_first_launched():
|
def handle_first_launched():
|
||||||
folder_path: str = appdirs.user_data_dir(appname="Unnamed_Password_Manager")
|
"""
|
||||||
|
Makes sure everything is initialized correctly
|
||||||
|
"""
|
||||||
|
folder_path: str = appdirs.user_data_dir()
|
||||||
|
folder_path = path.join(folder_path, "Unnamed_Password_Manager")
|
||||||
if not path.exists(folder_path):
|
if not path.exists(folder_path):
|
||||||
mkdir(folder_path)
|
mkdir(folder_path)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user