applied patch #2016003 - nsDialogs: Initial folder for SelectFileDialog
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5722 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
0215951357
commit
3c2db22eda
2 changed files with 873 additions and 859 deletions
File diff suppressed because it is too large
Load diff
|
@ -84,9 +84,11 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, ch
|
|||
OPENFILENAME ofn={0,}; // XXX WTF
|
||||
int save;
|
||||
char type[5];
|
||||
char path[1024];
|
||||
char filter[1024];
|
||||
char currentDirectory[1024];
|
||||
static char path[1024];
|
||||
static char filter[1024];
|
||||
static char currentDirectory[1024];
|
||||
static char initialDir[1024];
|
||||
DWORD gfa;
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
|
@ -104,6 +106,16 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, ch
|
|||
|
||||
save = !lstrcmpi(type, "save");
|
||||
|
||||
// Check if the path given is a folder. If it is we initialize the
|
||||
// ofn.lpstrInitialDir parameter
|
||||
gfa = GetFileAttributes(path);
|
||||
if ((gfa != INVALID_FILE_ATTRIBUTES) && (gfa & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
lstrcpy(initialDir, path);
|
||||
ofn.lpstrInitialDir = initialDir;
|
||||
path[0] = '\0'; // disable initial file selection as path is actually a directory
|
||||
}
|
||||
|
||||
if (!filter[0])
|
||||
{
|
||||
lstrcpy(filter, "All Files|*.*");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue