mardi 14 mai 2019

AutoHotKey script for Conan C/C++ package manager

Conan is a powerful binary package manager (https://conan.io/), but under Window it has from my point of view a small issue. In fact it's not so related to Conan itself but maybe more to Visual Studio.

As soon as you start build a complex software component that has a huge folder depth, Visual Studio may have issue during its link step. And as Conan replace your source folder in its 'data' folder (often located in C:\Users\...\.conan\data\modulename\version\ .....) you may be forced to use a specific Conan feature to correctly build a module under Window.

That feature is call "short_paths".

class module(ConanFile):
              ..... modules settings....
              short_paths = True
              .......


With that attribute Conan used to build and locate your package in a folder with a shorter depth (example, C:\.conan\n0wd_4uo). In the original Conan local repository you will find files named ".conan_link".

C:\Users\.....\.conan\data\NAME\VERSION\...\...\package\ID\.conan_link

It's a simple text file, but when you need to browse your package content it will be cumbersome o open it and copy/paste the folder URI in the explorer.

What's why I created a small AutoHotKey script to simplify that task. If that script is running in the background, you just have to select a .conan_link file and press 'F1' to follow the link in your explorer window.

Easy to setup and it save a lot of time.