From 8ad9ca97bb6fa4e30a685d36966035b6ab399119 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 18 May 2003 09:20:42 +0000 Subject: [PATCH] Don't prepend directory to filename for shortcuts git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/filedlg.tex | 5 +++++ src/msw/filedlg.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/latex/wx/filedlg.tex b/docs/latex/wx/filedlg.tex index 36657dadfe..29e10053dc 100644 --- a/docs/latex/wx/filedlg.tex +++ b/docs/latex/wx/filedlg.tex @@ -118,6 +118,11 @@ Fills the array {\it filenames} with the names of the files chosen. This function should only be used with the dialogs which have {\tt wxMULTIPLE} style, use \helpref{GetFilename}{wxfiledialoggetfilename} for the others. +Note that under Windows, if the user selects shortcuts, the filenames +include paths, since the application cannot determine the full path +of each referenced file by appending the directory containing the shortcuts +to the filename. + \membersection{wxFileDialog::GetFilterIndex}\label{wxfiledialoggetfilterindex} \constfunc{int}{GetFilterIndex}{\void} diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 0de0f976be..12d9f091e7 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -51,6 +51,7 @@ #include #include +#include "wx/filename.h" #include "wx/tokenzr.h" #ifndef OFN_EXPLORER @@ -229,7 +230,10 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const size_t count = m_fileNames.GetCount(); for ( size_t n = 0; n < count; n++ ) { - paths.Add(dir + m_fileNames[n]); + if (wxFileName(m_fileNames[n]).IsAbsolute()) + paths.Add(m_fileNames[n]); + else + paths.Add(dir + m_fileNames[n]); } } -- 2.45.2