Building Utility Helpers
17 Jan 2024
As a developer, it's great to build yourself little tools that make your life just a little bit easier. So today I wrote something to turn \ into /

I write my code in VS Code, where the code is stored on the windows C: drive. I do this because I use Gitkraken as my git client, and the code has to sit on that drive. But I run my code within WSL, so I have a utility that runs a couple of robocopy commands to copy files from c: to the WSL linux folder where the code runs.

And to do that, I wrote a little utility .exe using AutoIt, which runs those robocopy commands when I do CTRL+ALT+C. Nice and simple.

But today, something else annoyed me:

I wanted to debug in a file that was buried deep down in one of 3rd party packages I'm using. So I found the point I wanted to put the debug statement into, in VS code. Then right-clicked the file to copy the relative path (which was long) to the clipboard.

Copy relative path

I then hopped over to a WSL command line prompt and did "nano " then pasted the path.

Then edited all that to turn the \ into / so it actually worked.

I've done this a few times recently, and it was getting annoying.

So I pulled out my trusty Autoit, and wrote a little script to grab the clipboard contents, swap the slashes, and stick it back in the clipboard. And it does this on a SHIFT +ALT+V keypress.

Lovely! Took me about 10 minutes. Time well spent.

Here's the code if anyone is interested.

Get Updates

I don't post here frequently. So if you'd like me to let you know when I post something, subscribe below.

    I won't send you spam. You can unsubscribe at any time.

    RECENT POSTS

    Cursor running and fixing code

    I've recently started expanding my usage of Cursor to let it run commands, tests, etc and fix it's own issues. Here's my experience.