;; This is a hashmap of loaded files
(new Tree 'archives)
-;; A copy of the executable
-(define core:core (read-file "/proc/self/exe"))
+;; A copy of the executable (file descriptor 3)
+(define core:core
+ (letn ((FD 3) (SZ (seek FD)) (BUFFER (dup "" SZ)))
+ (seek FD 0) (read FD BUFFER SZ) BUFFER))
+(map delete '(FD SZ BUFFER GNU GNU))
(context 'archive)
-
(setf main nil)
-
-(constant 'AR "/usr/bin/ar" 'TAR "/bin/tar" 'FILE "/usr/bin/file")
+(constant
+ 'AR "/usr/bin/ar"
+ 'TAR (exists file? '("/bin/tar" "/usr/bin/tar"))
+ 'FILE "/usr/bin/file" )
(define (tar-able PATH)
(when (file? FILE)
*core:core*::
-This is a data reference functor that gets set up by reading
-"/proc/self/exe". This is only useful for an embedded binary where it
-will contain application's inc-core archive. Any other use case will
-need to redefine *core:core* for its in-core archive, if any.
+This is a data reference functor that gets set up by re-reading the
+executable as data block. This is only useful for an embedded binary
+where it will contain application's in-core archive. Any other use
+case will need to redefine *core:core* for its in-core archive
+if any.
(*archives* _FILENAME_ _ARCHIVE_)::