Skip to content

Commit

Permalink
Standardizing Windows data path and removing folder creation on import (
Browse files Browse the repository at this point in the history
#264)

* standardizing Windows data path

* Moving folder creation to _retrieve_file
  • Loading branch information
raph-luc authored Jun 1, 2023
1 parent fc8f0e2 commit f7066a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ansys/mapdl/reader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,9 @@
from . import _archive

# Setup data directory
try:
USER_DATA_PATH = appdirs.user_data_dir("ansys_mapdl_reader")
if not os.path.exists(USER_DATA_PATH): # pragma: no cover
os.makedirs(USER_DATA_PATH)
USER_DATA_PATH = appdirs.user_data_dir(appname="ansys_mapdl_reader", appauthor="Ansys")

EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")
if not os.path.exists(EXAMPLES_PATH): # pragma: no cover
os.makedirs(EXAMPLES_PATH)

except: # pragma: no cover
pass
EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")

# set pyvista defaults
_configure_pyvista()
3 changes: 3 additions & 0 deletions ansys/mapdl/reader/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def _get_file_url(filename):


def _retrieve_file(url, filename):
if not os.path.exists(pymapdl_reader.EXAMPLES_PATH):
os.makedirs(pymapdl_reader.EXAMPLES_PATH)

# First check if file has already been downloaded
local_path = os.path.join(pymapdl_reader.EXAMPLES_PATH, os.path.basename(filename))
local_path_no_zip = local_path.replace(".zip", "")
Expand Down

0 comments on commit f7066a6

Please sign in to comment.