forked from p15670423/monkey
Move `is_windows_os()` to separate file
This commit is contained in:
parent
2fb77fcb39
commit
37b7815e00
|
@ -1,10 +1,8 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from monkey_island.cc.environment.utils import is_windows_os
|
||||
from monkey_island.cc.environment.windows_permissions import set_full_folder_access
|
||||
|
||||
is_windows_os = sys.platform.startswith("win")
|
||||
|
||||
|
||||
def create_data_dir(data_dir: str, create_parent_dirs: bool) -> None:
|
||||
if not os.path.isdir(data_dir):
|
||||
|
@ -12,5 +10,5 @@ def create_data_dir(data_dir: str, create_parent_dirs: bool) -> None:
|
|||
os.makedirs(data_dir, mode=0o700)
|
||||
else:
|
||||
os.mkdir(data_dir, mode=0o700)
|
||||
if is_windows_os: # `mode=0o700` doesn't work on Windows
|
||||
if is_windows_os(): # `mode=0o700` doesn't work on Windows
|
||||
set_full_folder_access(folder_path=data_dir)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import sys
|
||||
|
||||
|
||||
def is_windows_os() -> bool:
|
||||
return sys.platform.startswith("win")
|
|
@ -1,12 +1,12 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from monkey_island.cc.environment.utils import is_windows_os
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
||||
|
||||
def get_default_data_dir() -> str:
|
||||
is_windows_os = sys.platform.startswith("win")
|
||||
if is_windows_os:
|
||||
if is_windows_os():
|
||||
return r"%AppData%\monkey_island"
|
||||
else:
|
||||
return r"$HOME/.monkey_island"
|
||||
|
|
Loading…
Reference in New Issue