L1nkZ/rpatchur

a couple questions regarding the code

olsonpm opened this issue · 2 comments

let index_str = words.get(0)?;

  1. (updated) Ah nvm, I'm assuming it's so that after a lot of patches you don't need to store them all in a single plist.txt ? i.e. you can remove old patches and just start from the number where you left off.

(original question)

I was wondering why you chose to format plist as {idx} {file name} rather than infer the index based off the line number ? Basically I'm not understanding why you'd want an out of order plist e.g.

2 some-file.thor
1 other-file.thor
  1. also do you mind explaining why you return none in the case of a failure instead of letting the error bubble up ?

Thanks

L1nkZ commented

Hi,

  1. I didn't actually choose the format plist.txt uses, I just supported the already existing format the THOR patcher was using. I agree that, to some extent, a simple ordered list, indexed by line number, would work well while being simpler to handle as a human.

  2. The main reason for that was to be able to use this method in a call to filter_map. The error handling in filter_map is "silent" which should be avoided in general, but I figured it was not too bad in this case and it had the benefit of transparently allowing for any type of inline comments (#, //, etc.) without making the code more complex.

  1. gosh I swore when I looked for documentation on the thor patcher the plist.txt syntax was just a list of the patches. Googling again I'm seeing the indexes at the beginning. My bad

  2. gotcha, thanks much

and fwiw I finally got it working last night. Mostly stupid mistakes on my part. I'll try to release the client side code in herc.ws in case others want to use a different skin.