Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Slash conversion
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Paul
New Member

USA
9 Posts

Posted - Mar 08 2016 :  1:50:07 PM  Show Profile  Reply with Quote
It would be handy to have functions that:

1) Convert backslashes to forward slashes.
\home\my\subfolder to /home/my/subfolder
2) Convert forward slashes to doubled backslashes.
/home/my/subfolder to \\home\\my\\subfolder
3) Convert single backslashes to doubled backslashes.
\home\my\subfolder to \\home\\my\\subfolder

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Mar 08 2016 :  2:14:54 PM  Show Profile  Reply with Quote
Have you considered simply using a find and replace? Are you looking to do this on strings? #include lines? Something else?

zen is the art of being at one with the two'ness
Go to Top of Page

Paul
New Member

USA
9 Posts

Posted - Mar 29 2016 :  11:54:09 AM  Show Profile  Reply with Quote
Mostly in strings that refer to file paths. We specify using forward slashes and let underlying code convert to the platform specific directory separators. That code can handle the backslashes as well, for neatness, consistency and correctness, I prefer everyone use the forward slashes.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Mar 29 2016 :  2:17:11 PM  Show Profile  Reply with Quote
You should be able to do a regular expression find and replace to do the replacements in strings fairly easily, but this is also going to update some, possibly quite a few #include lines as well.

Swapping / to \ in your #include statements won't matter, but changing \ to \\ may.

Thinking a little more, you could put a "line not starting with #" at the start of the regular expression, which should make this fairly safe and reliable.

Depending on your IDE, you could even wrap this up in an IDE macro, to make it easy to run this across your entire project.

"formatting" like this is not something VA offers, unfortunately, since everyone wants something different, and it quickly becomes a very complex area.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000