lighttigerXIV / catppuccinifier

Apply catppuccin flavors to your wallpapers
MIT License
164 stars 8 forks source link

catppuccinifier is unable to get the parent directory #27

Closed trien255 closed 1 year ago

trien255 commented 1 year ago

maybe saving the images in /tmp/catppuccinifier is not a good idea? since you need root permissions to write to that directory. you could provide the option to change the path images are saved to.

lighttigerXIV commented 1 year ago

maybe saving the images in /tmp/catppuccinifier is not a good idea? since you need root permissions to write to that directory. you could provide the option to change the path images are saved to.

Are you using a normal distro or are you using an immutable one? If it's a normal one it shouldn't require root for it.

trien255 commented 1 year ago

I actually thought it saved the image to /tmp, when the actual problem with permissions was that it could only take an absolute path to the file. it might be that it is not able to tell what the parent directory of the given file is, and for your question, I am using Archlinux. edit: I have tested it, and I was right the program is not able to find the parent directory somehow

lighttigerXIV commented 1 year ago

I actually thought it saved the image to /tmp, when the actual problem with permissions was that it could only take an absolute path to the file. it might be that it is not able to tell what the parent directory of the given file is, and for your question, I am using Archlinux. edit: I have tested it, and I was right the program is not able to find the parent directory somehow

Do any of the folders have spaces? I might have to report that to the lutgen crate

trien255 commented 1 year ago

fixed it. I just used fs::canonicalize to get the absolute path and then stored its parent. as it was seemingly struggling with getting the parent directory of a relative path (note that I have not tested the issue in windows)

fn main() {
    let cli = Cli::parse();
    let image_path = cli.image.to_str().unwrap();
    let bind_to_parent = fs::canonicalize(&cli.image).unwrap();
    let image_folder = bind_to_parent.parent().unwrap();
lighttigerXIV commented 1 year ago

Awesome. On the next release i will add that

trien255 commented 1 year ago

That is good to hear. I guess I will close the issue now