timothycrosley / streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
https://timothycrosley.github.io/streamdeck-ui/
MIT License
1.12k stars 240 forks source link

Added ~ path expansion for icons. #318

Closed NoUselessTech closed 1 year ago

NoUselessTech commented 1 year ago

This allows the ingested json file during import to use relative path locations using the (~) for icons instead of hard coded paths.

ianfloats commented 1 year ago

This seems right and won't break any existing configurations.

How about taking it one step further and saving path names with ~ when appropriate?

Something like this:

def replace_home_dir_with_tilde(absolute_path):
   home_dir = os.path.expanduser("~")
   if absolute_path.startswith(home_dir):
       return absolute_path.replace(home_dir, "~", 1)
   else:
       return absolute_path
StayPirate commented 1 year ago

amazing, I'm looking forward for this feature. Thanks

StayPirate commented 1 year ago

This PR is just a simple change, @timothycrosley would you mind to merge it?