File Paths in Ada
The Ada.Directories
package provides functions to parse and construct file paths in a way that is portable between operating systems.
To run the program, save it as file_paths.adb
and use your Ada compiler. For example, with GNAT:
Ada’s Ada.Directories
package provides similar functionality to Go’s filepath
package, but with some differences:
- Ada uses
Compose
instead of Join
to construct paths. - Ada’s
Containing_Directory
and Simple_Name
are similar to Go’s Dir
and Base
. - Ada doesn’t have a direct equivalent to Go’s
Rel
function for finding relative paths. - Ada’s
Extension
function is similar to Go’s Ext
.
Note that Ada’s path handling might behave differently on different operating systems, so always test your code on the target platform.