Use an older version of platformdirs

This commit is contained in:
grossmj 2023-08-12 19:15:29 +10:00
parent 090d1c8c84
commit a69feb3682
2 changed files with 4 additions and 9 deletions

View File

@ -21,6 +21,7 @@ import uuid
import asyncio
import aiohttp
import shutil
import platformdirs
try:
@ -86,14 +87,8 @@ class ApplianceManager:
Get the built-in appliance storage directory
"""
try:
import platformdirs
appname = vendor = "GNS3"
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
except ImportError:
# platformdirs is not available on Python 3.6, use the old method
config = Config.instance()
appliances_dir = os.path.join(config.config_dir, "appliances")
if delete_first:
shutil.rmtree(appliances_dir, ignore_errors=True)
os.makedirs(appliances_dir, exist_ok=True)

View File

@ -11,7 +11,7 @@ psutil==5.9.5
async-timeout>=4.0.2,<4.1
distro>=1.8.0
py-cpuinfo>=9.0.0,<10.0
platformdirs>=3.10.0; python_version >= '3.7'
platformdirs>=2.4.0
importlib-resources>=1.3; python_version <= '3.9'
truststore>=0.7.0; python_version >= '3.10'
setuptools>=60.8.1; python_version >= '3.7'