From b3455e502f4491af22e190a14aba9565f534bb59 Mon Sep 17 00:00:00 2001
From: Jedidiah Barber <contact@jedbarber.id.au>
Date: Wed, 16 Apr 2025 15:22:40 +1200
Subject: Sokoban can now find itself to find shared data after install

---
 src/misc.ads | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

(limited to 'src/misc.ads')

diff --git a/src/misc.ads b/src/misc.ads
index fb99d95..ad64b46 100644
--- a/src/misc.ads
+++ b/src/misc.ads
@@ -1,22 +1,21 @@
 
 
-with
+private with
 
-    Ada.Command_Line,
-    Ada.Directories;
+    Ada.Directories,
+    Here_I_Am;
 
 
 package Misc is
 
 
-    Origin : constant String;
+    Origin, Image_Path, Level_Path : constant String;
 
 
     function Max
            (A, B : in Integer)
         return Integer;
 
-
     function Min
            (A, B : in Integer)
         return Integer;
@@ -25,9 +24,24 @@ package Misc is
 private
 
 
-    Origin : constant String := Ada.Directories.Containing_Directory
-        (Ada.Directories.Full_Name (Ada.Command_Line.Command_Name));
+    package ADir renames Ada.Directories;
+
+
+    Origin : constant String := ADir.Containing_Directory (Here_I_Am.Executable);
+
+    Image_Path : constant String :=
+        ADir.Compose
+       (ADir.Compose
+       (ADir.Compose
+       (ADir.Compose (Origin, ".."), "share"), "sokoban"), "img");
+
+    Level_Path : constant String :=
+        ADir.Compose
+       (ADir.Compose
+       (ADir.Compose
+       (ADir.Compose (Origin, ".."), "share"), "sokoban"), "level");
 
 
 end Misc;
 
+
-- 
cgit