diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-02-24 12:41:51 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-02-24 12:41:51 +0000 |
commit | 160b9e62dc45f0448576bfbb59bc45702cbdfc24 (patch) | |
tree | 0be1966816a81b5a3143eb6231677928eb8e4d1b /get_path.c | |
parent | 1cd1c92fb7ca4fd663c19e45184982e2f66dd685 (diff) | |
download | mpv-160b9e62dc45f0448576bfbb59bc45702cbdfc24.tar.bz2 mpv-160b9e62dc45f0448576bfbb59bc45702cbdfc24.tar.xz |
On OS/2, fall back on the directory where MPlayer is installed if both
MPLAYER_HOME and HOME are not set.
patch by KO Myung-Hun, komh chollian net
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26088 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'get_path.c')
-rw-r--r-- | get_path.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/get_path.c b/get_path.c index eb889cc01f..9c8553a791 100644 --- a/get_path.c +++ b/get_path.c @@ -23,6 +23,11 @@ #include <windows.h> #endif +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + char *get_path(const char *filename){ char *homedir; char *buff; @@ -56,6 +61,25 @@ char *get_path(const char *filename){ exedir[imax]='\0'; homedir = exedir; } +#elif defined(__OS2__) + { + PPIB ppib; + char path[260]; + + // Get process info blocks + DosGetInfoBlocks(NULL, &ppib); + + // Get full path of the executable + DosQueryModuleName(ppib->pib_hmte, sizeof( path ), path); + + // Truncate name part including last backslash + *strrchr(path, '\\') = 0; + + // Convert backslash to slash + _fnslashify(path); + + homedir = path; + } #else return NULL; #endif |