Output the filename of the downloaded map somewhere
Closed this issue · 6 comments
I could manually query https://bar-springfiles.p2004a.com/find
to get this info, but would prefer to just use prd's --download-map
on its own if possible. Just need prd to print the filepath of the downloaded map somewhere so I can cache it
I would probably want to provide it once returning JSON is implemented.
What is the reason you need filename?
What is the reason you need filename?
So I can pass it through the map parser and cache it
Ack, makes sense, but given that you need to detect when players add maps manually so you need to trigger scan from time to time anyway I assume it's not high priority to add this feature.
Ack, makes sense, but given that you need to detect when players add maps manually so you need to trigger scan from time to time anyway I assume it's not high priority to add this feature.
Actually I tried to do that using fs.watch
and it's not reliable because the callback triggers as soon as the map file exists, which is as soon as the downloaded data starts getting written, and as far as I can tell there's no way to detect if the file is still being written to or not, which meant the parser trying to parse partial files and breaking. Otherwise you'd be right and I could just use that.
I'll have a look to see if there's any 3rd party watch libraries that can fix that issue but if native can't then I'm doubtful
Actually decided just gonna scan the whole dir again when the dl completes, so no worries on this one for now
callback triggers as soon as the map file exists,
I believe that current version of prd, (version from head and last released with engine) first creates file with extension .tmp
and then renames it to correct end name after download is completed and hash of file verified.