Skip to content

Commit bd29ee5

Browse files
authored
Merge pull request #191 from jviotti/appcwd
Expose the original $CWD as an environment variable
2 parents 733039e + 1569d6f commit bd29ee5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

runtime.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ main (int argc, char *argv[])
359359
/* Setting some environment variables that the app "inside" might use */
360360
setenv( "APPIMAGE", fullpath, 1 );
361361
setenv( "APPDIR", mount_dir, 1 );
362+
363+
/* Original working directory */
364+
char cwd[1024];
365+
if (getcwd(cwd, sizeof(cwd)) != NULL) {
366+
setenv( "OWD", cwd, 1 );
367+
}
368+
362369
execv (filename, real_argv);
363370
/* Error if we continue here */
364371
perror ("execv error: ");

0 commit comments

Comments
 (0)