Note: It is important to note that I am an AutoHotkey_H user.
As I have become more involved with the language, my ahk files have ballooned into a hard-to-manage form. I have certain standards that I do my best to keep when it comes to writing my own scripts and releasing them, but it feels like my goals conflict with my standards.
My current folder structure is bad, and this has become evident in two ways: one, whenever I download a stable, frequently-used script, I usually have to modify the includes to get it working. Secondly, there have been several "bug reports" from me to HotKeyIt that turned out, in short, to be due to my poor folder structure (sorry HotKeyIt!).
This post is somewhat lengthy, but I am doing my best to openly share my thoughts and reflections on proper standards any AHK developer should take, and I am looking for criticism from more senior developers.
Below are my current goals.
Goals:
- Scripts I write must work when run from any directory; so includes must use relative paths, and assumptions need to be made about the locations of AutoHotkey[Mini].dll/exe -- is this a bad idea? The real goal here is to make the scripts easy for other users to incorporate into their own scripts
- Keep downloaded scripts that I did not write separate from scripts that I did write, except for when I am packaging scripts (explained below)
- Structure my files in such a way the GitHub may seamlessly download/upload from those directories
- Package scripts so that they must be released as standalone .zips that will work "out of the box."
- Have a little update script that downloads the latest _H, extracts it, and updates my current AHK files -- I can write this script, but it doesn't work well with my current folder structure because I current have multiple copies of AutoHotkey[Mini].dll/exe
- Compiler
- lib
- other_scripts
- My own scripts go in here...
- Win32a
- other_scripts
- My own scripts go in here...
- packages
- Packaged scripts (working OOB) go in here...
- Lib files, although convenient, make it tricky for the packaged scripts to work properly. I tend to put whatever I can in lib, but the problem with this is that my scripts then require many std lib dependencies, and that seems to discourage people from testing my scripts -- perhaps this is just a poor choice on my part to put files in my std lib? I hate having so many folders with duplicate scripts though...is there perhaps a happy medium? Or do I need to face the fact that, given my goals, this is the price I have to pay.
- Compiling issues. Given my current structure, this is a big issue. Do I set working directory to A_ScriptDir? Right now, I am. But then the problem arises whenever I want to use AutoHotkey[Mini].dlls, I have to reference parent directories (I think A_AhkPath and A_AhkExe solves this issue, but should this have even been an issue?)