diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-04-05 23:06:26 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-04-05 23:06:26 +1300 |
commit | 10286c0b22f3111e74bf699f224a4e8061626d4c (patch) | |
tree | 172b3198153258b54aa4fd4540e7231ccfc66b7a /readme.md |
Initial commit
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..5dbf1fb --- /dev/null +++ b/readme.md @@ -0,0 +1,49 @@ + +## Here I Am! + +This is an Ada wrapper applied to the +[Where Am I?](https://github.com/gpakosz/whereami) library by Gregory Pakosz. +As with the original C, this allows for easily locating where the running +executable or module is stored in the filesystem. + +Note that this functionality is **not** something you can do with the Ada +standard library! + +The `Command_Name` subprogram in `Ada.Command_Line` will only get you the +command used to invoke the executable, which might be a symlink and/or might +have had a platform-specific `$PATH` used to find it. The `Current_Directory` +and `Containing_Directory` subprograms in `Ada.Directories` will only get you +the current working directory. That may be completely different from where the +executable is located if an absolute or relative path was supplied with the +command or, again, a platform-specific `$PATH` was involved. + +Of the options in the standard library the most reliable one would be to use +`Ada.Environment_Variables` and process each possible platform-specific `$PATH` +manually. But that still wouldn't resolve any symlinks or other shortcut files. + + + +#### Building and Installation + +If this was a dynamic library then the function to locate the current module +would always return the location of that shared object. On the other hand if +this was a static library then it wouldn't be possible to compile as part of a +dynamic libary. + +Thus, to use this you should instead just copy the contents of `src` wholesale +to a suitable spot in your own project. + +The `tests.gpr` project file can be used to build some very basic sanity checks +if desired. + + + +#### Credits and Licensing + +Ada wrapper code written by Jedidiah Barber and released into the public domain +as per `unlicense.txt`. + +C code written by Gregory Pakosz and licensed under the WTFPL which lets you do +whatever you want, so it's basically public domain as well. + + |