Author: cwittich
Date: Mon Jul 28 05:41:56 2008
New Revision: 34896
URL:
http://svn.reactos.org/svn/reactos?rev=34896&view=rev
Log:
use SHGetSpecialFolderPath instead of relying on envvars
Modified:
trunk/tools/RosBE/RosBE-Windows/Tools/config/makefile
trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/makefile
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/co…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/config/makefile [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/config/makefile [iso-8859-1] Mon Jul 28 05:41:56
2008
@@ -5,9 +5,9 @@
all: $(TARGET)
CC=gcc
-CFLAGS := -DWIN32 -DUNICODE -O2 -std=c99
+CFLAGS := -DWIN32 -DUNICODE -O2 -std=c99 -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0500
LFLAGS := -mwindows -s
-LIBS :=
+LIBS := -lshell32
SRCS := options.c
RC := options.rc
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/co…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c [iso-8859-1] Mon Jul 28
05:41:56 2008
@@ -37,12 +37,31 @@
return TRUE;
}
+static
+const
+WCHAR*
+getConfigFile()
+{
+ static WCHAR filename[MAX_PATH];
+ if (SHGetSpecialFolderPathW(NULL, filename, CSIDL_APPDATA, FALSE))
+ {
+ if ((wcslen(filename) + wcslen(L"\\RosBE\\rosbe-options.cmd")) <
MAX_PATH)
+ wcscat(filename, L"\\RosBE\\rosbe-options.cmd");
+ }
+ else
+ {
+ wcscpy(filename, L"rosbe-options.cmd");
+ }
+ return filename;
+}
+
+
INT
WriteSettings(POPTIONS_DLG infoPtr)
{
INT foreground, background;
BOOL showtime, writelog, useccache, strip, objstate, outstate;
- WCHAR logdir[MAX_PATH], objdir[MAX_PATH], outdir[MAX_PATH], mingwpath[MAX_PATH],
checkmgw[MAX_PATH], optionsfile[MAX_PATH];
+ WCHAR logdir[MAX_PATH], objdir[MAX_PATH], outdir[MAX_PATH], mingwpath[MAX_PATH],
checkmgw[MAX_PATH];
WCHAR msgerror[256];
HANDLE hFile;
FILE *pFile;
@@ -84,10 +103,7 @@
}
CloseHandle(hFile);
- wcscpy(optionsfile, _wgetenv(L"APPDATA"));
- if ((wcslen(optionsfile) + wcslen(L"\\RosBE\\rosbe-options.cmd")) <
MAX_PATH)
- wcscat(optionsfile, L"\\RosBE\\rosbe-options.cmd");
- pFile = _wfopen(optionsfile, L"w");
+ pFile = _wfopen(getConfigFile(), L"w");
if (pFile)
{
fwprintf(pFile, L"::\n");
@@ -114,16 +130,12 @@
VOID LoadSettings(POPTIONS_DLG infoPtr)
{
FILE *pFile;
- WCHAR optionsfile[MAX_PATH];
WCHAR *ptr, *ptr2;
WCHAR WTempLine[25+MAX_PATH];
WCHAR SBTitle[256];
PSETTINGS LoadedSettings = &infoPtr->Settings;
- wcscpy(optionsfile, _wgetenv(L"APPDATA"));
- if ((wcslen(optionsfile) + wcslen(L"\\RosBE\\rosbe-options.cmd")) <
MAX_PATH)
- wcscat(optionsfile, L"\\RosBE\\rosbe-options.cmd");
- pFile = _wfopen(optionsfile, L"r");
+ pFile = _wfopen(getConfigFile(), L"r");
if (pFile)
{
while (fgetws(WTempLine, 24+MAX_PATH, pFile))