Skip to content

Commit

Permalink
attempt macOS compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mprib committed Jun 21, 2023
1 parent 1f28e5f commit f21b1cf
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions pyxy3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,30 @@
__repo_issues_url__ = f"{__repo_url__}issues"


# set up local app data folder and logging
__app_dir__ = Path(os.getenv("LOCALAPPDATA"), __package_name__)
# # set up local app data folder and logging
# __app_dir__ = Path(os.getenv("LOCALAPPDATA"), __package_name__)
# __app_dir__.mkdir(exist_ok=True, parents=True)

# # create a toml file for user settings in LOCALAPPDATA and default the project folder to USER
# __settings_path__ = Path(__app_dir__, "settings.toml")

# __user_dir__ = Path(os.getenv("USERPROFILE"))
# # __user_dir__.mkdir(exist_ok=True,parents=True)

# Determine platform-specific application data directory
if os.name == 'nt': # Windows
app_data_dir = os.getenv('LOCALAPPDATA')
else: # macOS, Linux, and other UNIX variants
app_data_dir = os.path.join(os.path.expanduser("~"), '.local', 'share')

__app_dir__ = Path(app_data_dir, __package_name__)
__app_dir__.mkdir(exist_ok=True, parents=True)

# create a toml file for user settings in LOCALAPPDATA and default the project folder to USER
__settings_path__ = Path(__app_dir__, "settings.toml")
# Create a toml file for user settings in app data directory and default the project folder to USER
__settings_path__ = Path(__app_dir__, 'settings.toml')

__user_dir__ = Path(os.getenv("USERPROFILE"))
# __user_dir__.mkdir(exist_ok=True,parents=True)
# Get user home directory in a cross-platform way
__user_dir__ = Path(os.path.expanduser("~"))

if __settings_path__.exists():
USER_SETTINGS = toml.load(__settings_path__)
Expand Down

0 comments on commit f21b1cf

Please sign in to comment.