shilangyu / scoop-search

Fast `scoop search` drop-in replacement 🚀
MIT License
282 stars 10 forks source link

Can't read config file located in <SCOOP_DIR> #64

Open Gn3po4g opened 2 months ago

Gn3po4g commented 2 months ago

Description

Scoop can read portable config file in <SCOOP_DIR>/config.json since v0.4.0. But scoop-search doesn't use it.

Logs

The offending command causing the error with the $env:SCOOP_SEARCH_VERBOSE=1 env var set:

Commandline arguments: args.ParsedArgs{ .query = null, .hook = false, .allocator = mem.Allocator{ .ptr = anyopaque@e72f7feed0, 
  .vtable = mem.Allocator.VTable{ .alloc = fn (*anyopaque, usize, u8, usize) ?[*]u8@5920d0, .resize = fn (*anyopaque, []u8, u8, usize, 
  usize) bool@592170, .free = fn (*anyopaque, []u8, u8, usize) void@5921c0 } } }
env:SCOOP=
env:USERPROFILE=C:\Users\gnepo
env:XDG_CONFIG_HOME=
Scoop config file path: C:\Users\gnepo/.config/scoop/config.json
Scoop config file does not exist
Scoop home: C:\Users\gnepo/scoop
Could not open the buckets directory: C:\Users\gnepo/scoop/buckets.
shilangyu commented 2 months ago

Should be an easy fix. If I understand correctly <SCOOP_DIR> is the same as scoop home present in the logs you attached?

Gn3po4g commented 2 months ago

Yes but not really, because I removed the SCOOP environment variable to test scoopConfigFileOwned, so it reads the default USERPROFILE location. I installed Scoop in D:\Scoop so the config locate in D:\Scoop\config.json together with apps and buckets folder.

shilangyu commented 2 months ago

Okay thanks. I will investigate it (probably the easiest will be to just read scoop's source code) and send a fix at some point, but not in the coming days as I won't have time. If you are willing to work on this let me know, I would be happy to help. Seems like a very good introductory issue.