Skip to content

Commit

Permalink
[Win32] Fix initialValue issue
Browse files Browse the repository at this point in the history
  • Loading branch information
milani committed Oct 25, 2012
1 parent 48e778b commit 3aeb9b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
'link_settings': {
'libraries': [
'GdiPlus.lib',
'Shlwapi.lib',
'<(module_root_dir)/deps/cef/lib/Release/libcef.lib',
'<(module_root_dir)/build/Release/lib/libcef_dll_wrapper.node'
],
Expand Down
17 changes: 7 additions & 10 deletions src/native_window/native_window_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define max(left,right) std::max(left,right)
#include <gdiplus.h>
#include <shlobj.h>
#include <shlwapi.h>
#include "appjs.h"
#include "includes/cef.h"
#include "includes/util.h"
Expand Down Expand Up @@ -578,15 +579,9 @@ void NativeWindow::OpenFileDialog(uv_work_t* req) {
bool multiSelect = settings->reserveBool1;
bool dirSelect = settings->reserveBool2;


//Cef::Pause();

settings->result = NULL;
char filename[MAX_PATH*10];
ZeroMemory(&filename, sizeof(filename));
//strcpy(filename, settings->initialValue.c_str());
//filename[settings->initialValue.size()] = 0;
//filename[MAX_PATH] = 0;

if (dirSelect) {
LPMALLOC pMalloc = NULL;
Expand Down Expand Up @@ -623,11 +618,14 @@ void NativeWindow::OpenFileDialog(uv_work_t* req) {
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrTitle = settings->title.c_str();
ofn.Flags = OFN_NOCHANGEDIR | OFN_FORCESHOWHIDDEN;
ofn.lpstrFile = filename;
ofn.nMaxFile = sizeof(filename);
ofn.lpstrFilter = acceptTypes.c_str();
if (!settings->initialValue.size()) {
ofn.nMaxFile = MAX_PATH;
if (PathIsDirectory(settings->initialValue.c_str())) {
ofn.lpstrInitialDir = settings->initialValue.c_str();
ofn.lpstrFile = filename;
} else {
strcpy(filename, settings->initialValue.c_str());
ofn.lpstrFile = filename;
}

BOOL result;
Expand All @@ -646,7 +644,6 @@ void NativeWindow::OpenFileDialog(uv_work_t* req) {
}
}

//Cef::Run();
}

void NativeWindow::ProcessFileDialog(uv_work_t* req) {
Expand Down

0 comments on commit 3aeb9b1

Please sign in to comment.