Skip to content

Commit

Permalink
fix file chooser changing current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
notsecure committed Jul 8, 2014
1 parent 5affac5 commit 7b95cd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion win32/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,24 @@ void openfilesend(void)
char *filepath = malloc(1024);
filepath[0] = 0;

wchar_t dir[1024];
GetCurrentDirectoryW(countof(dir), dir);

OPENFILENAME ofn = {
.lStructSize = sizeof(OPENFILENAME),
.hwndOwner = hwnd,
.lpstrFile = filepath,
.nMaxFile = 1024,
.Flags = OFN_EXPLORER | OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
.Flags = OFN_EXPLORER | OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST,
};

if(GetOpenFileName(&ofn)) {
tox_postmessage(TOX_SENDFILES, (FRIEND*)sitem->data - friend, ofn.nFileOffset, filepath);
} else {
debug("GetOpenFileName() failed\n");
}

SetCurrentDirectoryW(dir);
}

void savefilerecv(uint32_t fid, MSG_FILE *file)
Expand Down

0 comments on commit 7b95cd0

Please sign in to comment.