mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 02:42:25 +01:00
Made minetest directory handling, platform indiependent
This commit is contained in:
parent
ddfbd331c9
commit
0da8428eef
@ -1,9 +1,30 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
def get_minetest_directory():
|
||||
system = platform.system()
|
||||
|
||||
# Windows
|
||||
if system == 'Windows':
|
||||
return os.environ.get('MINETEST_USER_PATH', os.path.expandvars('%APPDATA%\\Minetest'))
|
||||
|
||||
# Linux
|
||||
elif system == 'Linux':
|
||||
return os.environ.get('MINETEST_USER_PATH', os.path.expanduser('~/.minetest'))
|
||||
|
||||
# macOS
|
||||
elif system == 'Darwin': # Darwin is the system name for macOS
|
||||
return os.environ.get('MINETEST_USER_PATH', os.path.expanduser('~/Library/Application Support/minetest'))
|
||||
|
||||
# Unsupported system
|
||||
else:
|
||||
return None
|
||||
|
||||
# Constants
|
||||
SUPPORTED_MINECRAFT_VERSION = "1.20"
|
||||
|
||||
# Helper vars
|
||||
home = os.environ["HOME"]
|
||||
mineclone2_path = home + "/.minetest/games/mineclone2"
|
||||
mineclone2_path = os.path.join(get_minetest_directory(),"games","mineclone2")
|
||||
working_dir = os.getcwd()
|
||||
appname = "Texture_Converter.py"
|
||||
|
@ -130,7 +130,7 @@ class TextureConverterGUI:
|
||||
pixelsize = None
|
||||
dry_run = False
|
||||
verbose = False
|
||||
output_dir = os.path.join(home, ".minetest", "textures")
|
||||
output_dir = os.path.join(get_minetest_directory(), "textures")
|
||||
make_texture_pack = True
|
||||
|
||||
# Determine the resource packs to convert based on the option
|
||||
|
@ -10,7 +10,7 @@ import zipfile
|
||||
from .config import SUPPORTED_MINECRAFT_VERSION, home
|
||||
from PIL import Image
|
||||
from collections import Counter
|
||||
|
||||
import platform
|
||||
|
||||
def detect_pixel_size(directory):
|
||||
sizes = []
|
||||
|
Loading…
Reference in New Issue
Block a user