mirror of
https://github.com/GNS3/gns3-server
synced 2025-06-08 17:18:51 +00:00
Fix copying appliances and configs when app is frozen
This commit is contained in:
parent
d33fefa183
commit
284a4b62fb
@ -278,6 +278,12 @@ class Controller:
|
|||||||
|
|
||||||
dst_path = self.configs_path()
|
dst_path = self.configs_path()
|
||||||
try:
|
try:
|
||||||
|
if hasattr(sys, "frozen"):
|
||||||
|
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), "configs"))
|
||||||
|
for filename in os.listdir(resource_path):
|
||||||
|
if not os.path.exists(os.path.join(dst_path, filename)):
|
||||||
|
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
||||||
|
else:
|
||||||
for entry in importlib_resources.files('gns3server.configs').iterdir():
|
for entry in importlib_resources.files('gns3server.configs').iterdir():
|
||||||
full_path = os.path.join(dst_path, entry.name)
|
full_path = os.path.join(dst_path, entry.name)
|
||||||
if entry.is_file() and not os.path.exists(full_path):
|
if entry.is_file() and not os.path.exists(full_path):
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
@ -26,7 +27,6 @@ import shutil
|
|||||||
from .appliance import Appliance
|
from .appliance import Appliance
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..utils.asyncio import locking
|
from ..utils.asyncio import locking
|
||||||
from ..utils.get_resource import get_resource
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -93,6 +93,12 @@ class ApplianceManager:
|
|||||||
|
|
||||||
dst_path = self._builtin_appliances_path()
|
dst_path = self._builtin_appliances_path()
|
||||||
try:
|
try:
|
||||||
|
if hasattr(sys, "frozen"):
|
||||||
|
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), "appliances"))
|
||||||
|
for filename in os.listdir(resource_path):
|
||||||
|
if not os.path.exists(os.path.join(dst_path, filename)):
|
||||||
|
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
||||||
|
else:
|
||||||
for entry in importlib_resources.files('gns3server.appliances').iterdir():
|
for entry in importlib_resources.files('gns3server.appliances').iterdir():
|
||||||
full_path = os.path.join(dst_path, entry.name)
|
full_path = os.path.join(dst_path, entry.name)
|
||||||
if entry.is_file() and not os.path.exists(full_path):
|
if entry.is_file() and not os.path.exists(full_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user