[F] Fix windows paths
This commit is contained in:
parent
8a4a96634c
commit
59fa4e5ecc
2 changed files with 10 additions and 3 deletions
|
@ -6,6 +6,7 @@ import json
|
|||
import random
|
||||
import re
|
||||
from itertools import permutations
|
||||
import traceback
|
||||
from typing import Iterable
|
||||
from math import ceil
|
||||
|
||||
|
@ -389,7 +390,11 @@ def run():
|
|||
preset = preset.set_light_dl(config.lightness)
|
||||
|
||||
# Run
|
||||
run_neofetch(preset, config.color_align)
|
||||
try:
|
||||
run_neofetch(preset, config.color_align)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
traceback.print_exc()
|
||||
|
||||
if args.ask_exit:
|
||||
input('Press any key to exit...')
|
||||
|
|
|
@ -6,6 +6,7 @@ import platform
|
|||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
@ -145,7 +146,7 @@ def get_command_path() -> str:
|
|||
|
||||
# Windows doesn't support symbolic links, but also I can't detect symbolic links... hard-code it here for now.
|
||||
if platform.system() == 'Windows':
|
||||
return str(Path(cmd_path).parent.parent / 'neofetch')
|
||||
return str(Path(cmd_path).parent.parent.parent / 'neofetch')
|
||||
|
||||
return cmd_path
|
||||
|
||||
|
@ -192,11 +193,12 @@ def check_windows_cmd():
|
|||
"""
|
||||
if platform.system() == 'Windows':
|
||||
import psutil
|
||||
# TODO: This line does not correctly identify cmd prompts...
|
||||
if psutil.Process(os.getppid()).name().lower().strip() == 'cmd.exe':
|
||||
print("cmd.exe doesn't support RGB colors, restarting in MinTTY...")
|
||||
cmd = f'"{ensure_git_bash().parent.parent / "usr/bin/mintty.exe"}" -s 110,40 -e python -m hyfetch --ask-exit'
|
||||
os.system(cmd)
|
||||
exit()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def run_command(args: str, pipe: bool = False) -> str | None:
|
||||
|
|
Loading…
Reference in a new issue