Nivekk / KOS

Fully programmable autopilot mod for KSP.
Other
80 stars 30 forks source link

Allowing dashes in filenames #155

Closed xZise closed 11 years ago

xZise commented 11 years ago

This, adds a new meta character & which denotes a file name including dashes. This fixes #150.

Please note, that there might be other commands which should use the new meta character instead of %, if that value can't be a variable.

Actually shouldn't ^ and & allow any type of name? So also names beginning with a number, underscore or dash? Instead of [a-zA-Z][a-zA-Z0-9_\\-]*? simply [a-zA-Z0-9_\\-]+?.

DISCLAIMER: As my computer is not set up for development and testing C#, I'm not sure that this code works as promised. (I really have to set up my computer for developing KSP plugins)

xZise commented 11 years ago

Okay I changed the regexes from ^ and & allowing a dash, underscore or number being the first character. I also (hopefully) fixed #151, as the optional volume name now requires at least one white space character in front of it: When in a squared brackets section the first character is a colon (:) it treads the contents as kegexes instead of regexes.

Unfortunately I can't test it :(

Nivekk commented 11 years ago

I merged most of what you had but some things I changed:

xZise commented 11 years ago

I'm currently on my phone so it's not that easy to check, but I thought that string[42] gets me the 43rd char. Like - great paste doesn't work here, links will follow after I got up.

And unfortunately added you another purpose for ampersand before so there is/was a conflict.

So far I hope the code wasn't completely useless. Hmpf why doesn't github show the content of commits in the mobile version.

xZise commented 11 years ago

Okay here it says, that string[42] should indeed return the 43rd char: http://msdn.microsoft.com/en-us/library/system.string.chars.aspx

Fabian