moved maps to cache dir
This commit is contained in:
parent
ca74986b82
commit
bbb248da16
@ -1,6 +1,8 @@
|
||||
import os
|
||||
from math import floor
|
||||
from typing import Optional
|
||||
|
||||
import platformdirs
|
||||
import pygame
|
||||
|
||||
from src.image_handler import ImageHandler
|
||||
@ -10,7 +12,7 @@ class Editor:
|
||||
WIDTH: int = 800
|
||||
HEIGHT: int = 600
|
||||
MAP_SIZE: int = 1024
|
||||
MAPS_DIR: str = "/tmp/lycacraft_maps"
|
||||
MAPS_DIR: str = os.path.join(platformdirs.user_cache_dir(appname="lycacraft-paths", appauthor="Lycacraft"), "maps")
|
||||
ZOOMS: tuple[float] = (0.25, 0.5, 1, 2, 4)
|
||||
CROSSHAIR_SIZE: int = 10
|
||||
|
||||
|
@ -2,10 +2,11 @@ from math import ceil, log10
|
||||
import os.path
|
||||
|
||||
from PIL import Image
|
||||
import platformdirs
|
||||
|
||||
Image.MAX_IMAGE_PIXELS = 200000000
|
||||
MAP_SIZE = 1024
|
||||
|
||||
DEFAULT_PATH = os.path.join(platformdirs.user_cache_dir(appname="lycacraft-paths", appauthor="Lycacraft"), "maps")
|
||||
|
||||
def clamp(mn, value, mx):
|
||||
return max(mn, min(mx, value))
|
||||
@ -15,12 +16,12 @@ def main():
|
||||
# 2024-06-27_21.01.45_Lycacraft_minecraft~overworld_day.png
|
||||
# 6144,10240
|
||||
input_path = input("Input image: ")
|
||||
output_path = input("Output dir (default: /tmp/lycacraft_maps/): ")
|
||||
output_path = input(f"Output dir (default: {DEFAULT_PATH}): ")
|
||||
if output_path.strip() == "":
|
||||
output_path = "/tmp/lycacraft_maps"
|
||||
output_path = DEFAULT_PATH
|
||||
|
||||
if not os.path.exists(output_path):
|
||||
os.mkdir(output_path)
|
||||
os.makedirs(output_path)
|
||||
elif not os.path.isdir(output_path):
|
||||
print("Output path must be a directory")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user