mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Win32: Put .elinks in Application Data if %HOME% is undefined.
This commit is contained in:
parent
375d8cc905
commit
f0bc5c5abe
@ -111,8 +111,14 @@ get_home(void)
|
|||||||
{
|
{
|
||||||
unsigned char *home_elinks;
|
unsigned char *home_elinks;
|
||||||
unsigned char *envhome = getenv("HOME");
|
unsigned char *envhome = getenv("HOME");
|
||||||
unsigned char *home = envhome ? stracpy(envhome)
|
unsigned char *home = NULL;
|
||||||
: elinks_dirname(program.path);
|
|
||||||
|
if (!home && envhome)
|
||||||
|
home = stracpy(envhome);
|
||||||
|
if (!home)
|
||||||
|
home = user_appdata_directory();
|
||||||
|
if (!home)
|
||||||
|
home = elinks_dirname(program.path);
|
||||||
|
|
||||||
if (home)
|
if (home)
|
||||||
strip_trailing_dir_sep(home);
|
strip_trailing_dir_sep(home);
|
||||||
|
@ -75,4 +75,8 @@ unsigned char *get_shell(void);
|
|||||||
* available at all. Face it, we are just cool. */
|
* available at all. Face it, we are just cool. */
|
||||||
void elinks_cfmakeraw(struct termios *t);
|
void elinks_cfmakeraw(struct termios *t);
|
||||||
|
|
||||||
|
#ifndef user_appdata_directory
|
||||||
|
#define user_appdata_directory() NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Get SHGFP_TYPE_CURRENT from <shlobj.h>. */
|
||||||
|
#define _WIN32_IE 0x500
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
|
||||||
#include "osdep/system.h"
|
#include "osdep/system.h"
|
||||||
|
|
||||||
@ -258,3 +262,21 @@ gettext__parse(void *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unsigned char *
|
||||||
|
user_appdata_directory(void)
|
||||||
|
{
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
HWND hwnd = GetConsoleWindow();
|
||||||
|
#else
|
||||||
|
HWND hwnd = NULL;
|
||||||
|
#endif
|
||||||
|
char path[MAX_PATH];
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = SHGetFolderPath(hwnd, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path);
|
||||||
|
if (hr == S_OK) /* Don't even allow S_FALSE. */
|
||||||
|
return stracpy(path);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -13,6 +13,8 @@ struct terminal;
|
|||||||
|
|
||||||
void open_in_new_win32(struct terminal *term, unsigned char *exe_name,
|
void open_in_new_win32(struct terminal *term, unsigned char *exe_name,
|
||||||
unsigned char *param);
|
unsigned char *param);
|
||||||
|
unsigned char *user_appdata_directory(void);
|
||||||
|
#define user_appdata_directory user_appdata_directory
|
||||||
|
|
||||||
|
|
||||||
/* Stub functions: */
|
/* Stub functions: */
|
||||||
|
Loading…
Reference in New Issue
Block a user