Skip to content

Commit e7d9287

Browse files
authored
Add files via upload
1 parent 729fa2b commit e7d9287

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

src/viv.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ static int _viv_should_show_cursor(void);
548548
static void _viv_update_show_cursor(void);
549549
static void _viv_start_hide_cursor_timer(void);
550550
static int _viv_main(int nCmdShow);
551+
static void _viv_get_exe_filename(wchar_t filename[STRING_SIZE]);
551552

552553
static HMODULE _viv_stobject_hmodule = 0;
553554
static _viv_playlist_t *_viv_playlist_start = 0;
@@ -4361,7 +4362,7 @@ static int _viv_process_install_command_line_options(wchar_t *cl)
43614362
wchar_t params[STRING_SIZE];
43624363
wchar_t cwd[STRING_SIZE];
43634364

4364-
GetModuleFileName(0,exe_filename,STRING_SIZE);
4365+
_viv_get_exe_filename(exe_filename);
43654366
GetCurrentDirectory(STRING_SIZE,cwd);
43664367

43674368
string_copy_utf8(params,(const utf8_t *)"/isrunas ");
@@ -8143,7 +8144,7 @@ static INT_PTR CALLBACK _viv_options_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARA
81438144
{
81448145
wchar_t exe_filename[STRING_SIZE];
81458146

8146-
GetModuleFileName(0,exe_filename,STRING_SIZE);
8147+
_viv_get_exe_filename(exe_filename);
81478148

81488149
os_shell_execute(0,exe_filename,1,NULL,params);
81498150
}
@@ -8205,7 +8206,7 @@ static void _viv_install_association_by_extension(const char *association,const
82058206
wchar_t filename[STRING_SIZE];
82068207
wchar_t command[STRING_SIZE];
82078208

8208-
GetModuleFileName(0,filename,STRING_SIZE);
8209+
_viv_get_exe_filename(filename);
82098210

82108211
string_copy(command,filename);
82118212

@@ -8240,7 +8241,7 @@ static void _viv_install_association_by_extension(const char *association,const
82408241
wchar_t filename[STRING_SIZE];
82418242
wchar_t command[STRING_SIZE];
82428243

8243-
GetModuleFileName(0,filename,STRING_SIZE);
8244+
_viv_get_exe_filename(filename);
82448245

82458246
string_copy_utf8(command,(const utf8_t *)"\"");
82468247
string_cat(command,filename);
@@ -8372,7 +8373,7 @@ static int _viv_is_association(const char *association)
83728373

83738374
//debug_printf("key OK\n",key);
83748375

8375-
GetModuleFileName(0,filename,STRING_SIZE);
8376+
_viv_get_exe_filename(filename);
83768377

83778378
string_copy_utf8(command,(const utf8_t *)"\"");
83788379
string_cat(command,filename);
@@ -11744,7 +11745,7 @@ static void _viv_install_start_menu_shortcuts(void)
1174411745
os_make_sure_path_exists(path_wbuf);
1174511746

1174611747
// void image viewer.lnk
11747-
GetModuleFileName(NULL,exe_filename_wbuf,STRING_SIZE);
11748+
_viv_get_exe_filename(exe_filename_wbuf);
1174811749
string_path_combine_utf8(lnk_wbuf,path_wbuf,"void Image Viewer.lnk");
1174911750
os_create_shell_link(exe_filename_wbuf,lnk_wbuf);
1175011751

@@ -13338,3 +13339,21 @@ static void _viv_start_hide_cursor_timer(void)
1333813339
_viv_is_hide_cursor_timer = 1;
1333913340
}
1334013341
}
13342+
13343+
static void _viv_get_exe_filename(wchar_t filename[STRING_SIZE])
13344+
{
13345+
filename[0] = 0;
13346+
13347+
GetModuleFileName(0,filename,STRING_SIZE);
13348+
13349+
// make sure the drive letter is uppercase.
13350+
// launching from .png == d:
13351+
// launching from .exe == D:
13352+
if ((*filename >= 'a') && (*filename <= 'z'))
13353+
{
13354+
if (filename[1] == ':')
13355+
{
13356+
*filename = *filename - 'a' + 'A';
13357+
}
13358+
}
13359+
}

0 commit comments

Comments
 (0)