diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-08 17:49:05 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-08 17:49:05 +0000 |
commit | 63597e4ebc117bb561b93f4d775d787120e6728a (patch) | |
tree | a4825625ef2ff06b339e56a30fa5ae80aea29160 | |
parent | c48abb01ae7e295e283f190bd05270e835b8d37f (diff) | |
download | chromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.zip chromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.tar.gz chromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.tar.bz2 |
Deprecate most of the remaining wstring file_util functions.
These still exist on Windows due to being used by the installer,
but by moving them into the Windows-only block we prevent them
from being used in new code. (I am already finding new code using
some of these! I am glad to be rid of them.)
BUG=24672
Review URL: http://codereview.chromium.org/2850042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51862 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/file_util_deprecated.h | 42 | ||||
-rw-r--r-- | base/file_util_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 3 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 4 | ||||
-rw-r--r-- | chrome/browser/printing/printing_layout_uitest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/shell_integration.cc | 10 | ||||
-rw-r--r-- | chrome/browser/shell_integration.h | 2 | ||||
-rw-r--r-- | chrome/tools/convert_dict/aff_reader.cc | 3 | ||||
-rw-r--r-- | chrome/tools/convert_dict/dic_reader.cc | 6 | ||||
-rw-r--r-- | printing/image.cc | 9 | ||||
-rw-r--r-- | printing/image.h | 7 | ||||
-rw-r--r-- | tools/imagediff/image_diff.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 4 |
19 files changed, 89 insertions, 67 deletions
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h index a5b7899..dd2ffc8 100644 --- a/base/file_util_deprecated.h +++ b/base/file_util_deprecated.h @@ -15,29 +15,17 @@ #include "build/build_config.h" -namespace file_util { - -// Use FilePath::Extension instead. -FilePath::StringType GetFileExtensionFromPath(const FilePath& path); -std::wstring GetFileExtensionFromPath(const std::wstring& path); -bool AbsolutePath(std::wstring* path); - -// Use FilePath::InsertBeforeExtension. -void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix); +namespace file_util { -bool Delete(const std::wstring& path, bool recursive); -bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, - bool recursive); -bool ReadFileToString(const std::wstring& path, std::string* contents); +// Use the FilePath versions instead. FILE* OpenFile(const std::string& filename, const char* mode); FILE* OpenFile(const std::wstring& filename, const char* mode); -int ReadFile(const std::wstring& filename, char* data, int size); -int WriteFile(const std::wstring& filename, const char* data, int size); -// Functions successfully deprecated on non-Windows, but Win-specific -// callers remain. +// We've successfully deprecated most of these functions on non-Windows +// platforms. #if defined(OS_WIN) + // Use FilePath::DirName instead. void UpOneDirectory(std::wstring* dir); // Use FilePath::DirName instead. @@ -60,7 +48,25 @@ std::wstring GetDirectoryFromPath(const std::wstring& path); // Appends new_ending to path, adding a separator between the two if necessary. void AppendToPath(std::wstring* path, const std::wstring& new_ending); -#endif + +// Use FilePath::Extension instead. +FilePath::StringType GetFileExtensionFromPath(const FilePath& path); +std::wstring GetFileExtensionFromPath(const std::wstring& path); + +bool AbsolutePath(std::wstring* path); + +// Use FilePath::InsertBeforeExtension. +void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix); + +// Use version that takes a FilePath. +bool Delete(const std::wstring& path, bool recursive); +bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, + bool recursive); +bool ReadFileToString(const std::wstring& path, std::string* contents); +int ReadFile(const std::wstring& filename, char* data, int size); +int WriteFile(const std::wstring& filename, const char* data, int size); + +#endif // OS_WIN } diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index fd54963..7acf00c 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -292,6 +292,8 @@ static const struct InsertBeforeExtensionCase { #endif }; +#if defined(OS_WIN) +// This function has been deprecated on non-Windows. TEST_F(FileUtilTest, InsertBeforeExtensionTest) { for (unsigned int i = 0; i < arraysize(kInsertBeforeExtension); ++i) { FilePath path(kInsertBeforeExtension[i].path); @@ -299,6 +301,7 @@ TEST_F(FileUtilTest, InsertBeforeExtensionTest) { EXPECT_EQ(kInsertBeforeExtension[i].result, path.value()); } } +#endif static const struct filename_case { const wchar_t* path; @@ -363,6 +366,8 @@ static const struct extension_case { #endif }; +#if defined(OS_WIN) +// This function has been deprecated on non-Windows. TEST_F(FileUtilTest, GetFileExtensionFromPath) { for (unsigned int i = 0; i < arraysize(extension_cases); ++i) { const extension_case& ext = extension_cases[i]; @@ -370,6 +375,7 @@ TEST_F(FileUtilTest, GetFileExtensionFromPath) { EXPECT_EQ(ext.extension, fext); } } +#endif // Test finding the directory component of a path static const struct dir_case { diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index b41be08..fe4a463 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1327,8 +1327,9 @@ void DownloadManager::GenerateExtension( FILE_PATH_LITERAL("download"); // See if our file name already contains an extension. - FilePath::StringType extension( - file_util::GetFileExtensionFromPath(file_name)); + FilePath::StringType extension = file_name.Extension(); + if (!extension.empty()) + extension.erase(extension.begin()); // Erase preceding '.'. #if defined(OS_WIN) // Rename shell-integrated extensions. diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 2da4c14..591eb83 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -490,8 +490,7 @@ void UpdateAppIconDownloadProgress(int download_count, // Appends the passed the number between parenthesis the path before the // extension. void AppendNumberToPath(FilePath* path, int number) { - file_util::InsertBeforeExtension(path, - StringPrintf(FILE_PATH_LITERAL(" (%d)"), number)); + *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); } // Attempts to find a number that can be appended to that path to make it diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index db34e35..f95ba7c 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -1084,7 +1084,9 @@ FilePath SavePackage::GetSuggestedNameForSaveAs(const FilePath& name, FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { // If the file name doesn't have an extension suitable for HTML files, // append one. - FilePath::StringType ext = file_util::GetFileExtensionFromPath(name); + FilePath::StringType ext = name.Extension(); + if (!ext.empty()) + ext.erase(ext.begin()); // Erase preceding '.'. std::string mime_type; if (!net::GetMimeTypeFromExtension(ext, &mime_type) || !CanSaveAsComplete(mime_type)) { diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc index 5cfe387..501a7b3 100644 --- a/chrome/browser/printing/printing_layout_uitest.cc +++ b/chrome/browser/printing/printing_layout_uitest.cc @@ -80,15 +80,15 @@ class PrintingLayoutTest : public PrintingTest<UITest> { if (GenerateFiles()) { // Copy the .emf and generate an .png. file_util::CopyFile(test_result, emf); - Image emf_content(emf.value()); + Image emf_content(emf); emf_content.SaveToPng(png); // Saving is always fine. return 0; } else { // File compare between test and result. - Image emf_content(emf.value()); - Image test_content(test_result.value()); - Image png_content(png.value()); + Image emf_content(emf); + Image test_content(test_result); + Image png_content(png); double diff_emf = emf_content.PercentageDifferent(test_content); EXPECT_EQ(0., diff_emf) << verification_name << diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index 23d9fcb..492bb06 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -18,13 +18,15 @@ std::string ShellIntegration::GetCommandLineArgumentsCommon(const GURL& url, std::wstring arguments_w; // Use the same UserDataDir for new launches that we currently have set. - std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir); - if (!user_data_dir.empty()) { + FilePath user_data_dir = cmd.GetSwitchValuePath(switches::kUserDataDir); + if (!user_data_dir.value().empty()) { // Make sure user_data_dir is an absolute path. if (file_util::AbsolutePath(&user_data_dir) && - file_util::PathExists(FilePath::FromWStringHack(user_data_dir))) { + file_util::PathExists(user_data_dir)) { + // TODO: This is wrong in pathological quoting scenarios; we shouldn't be + // passing around command lines as strings at all. arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) + - L"=\"" + user_data_dir + L"\" "; + L"=\"" + user_data_dir.ToWStringHack() + L"\" "; } } diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 670063e..a468a46 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -71,6 +71,8 @@ class ShellIntegration { // which is deprecated. If |extension_app_id| is non-empty, an arguments // string is created using the kAppId=<id> flag. Otherwise, the kApp=<url> is // used. + // FIXME This function is dangerous, do not use! You cannot treat + // command lines as plain strings as there are metacharacters. static std::string GetCommandLineArgumentsCommon(const GURL& url, const string16& extension_app_id); diff --git a/chrome/tools/convert_dict/aff_reader.cc b/chrome/tools/convert_dict/aff_reader.cc index ea7e2a8..767ba92 100644 --- a/chrome/tools/convert_dict/aff_reader.cc +++ b/chrome/tools/convert_dict/aff_reader.cc @@ -48,7 +48,8 @@ void CollapseDuplicateSpaces(std::string* str) { AffReader::AffReader(const std::string& filename) : has_indexed_affixes_(false) { - file_ = file_util::OpenFile(filename, "r"); + FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename)); + file_ = file_util::OpenFile(path, "r"); // Default to Latin1 in case the file doesn't specify it. encoding_ = "ISO8859-1"; diff --git a/chrome/tools/convert_dict/dic_reader.cc b/chrome/tools/convert_dict/dic_reader.cc index 2233d04..bac3162 100644 --- a/chrome/tools/convert_dict/dic_reader.cc +++ b/chrome/tools/convert_dict/dic_reader.cc @@ -129,8 +129,10 @@ bool PopulateWordSet(WordSet* word_set, FILE* file, AffReader* aff_reader, } // namespace DicReader::DicReader(const std::string& filename) { - file_ = file_util::OpenFile(filename, "r"); - additional_words_file_ = file_util::OpenFile(filename + "_delta", "r"); + FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename)); + file_ = file_util::OpenFile(path, "r"); + additional_words_file_ = + file_util::OpenFile(FilePath(path.InsertBeforeExtension("_delta")), "r"); } DicReader::~DicReader() { diff --git a/printing/image.cc b/printing/image.cc index d12d3d60..77f5d5e 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -60,16 +60,15 @@ class DisableFontSmoothing { namespace printing { -Image::Image(const std::wstring& filename) +Image::Image(const FilePath& path) : row_length_(0), ignore_alpha_(true) { std::string data; - file_util::ReadFileToString(filename, &data); - std::wstring ext = file_util::GetFileExtensionFromPath(filename); + file_util::ReadFileToString(path, &data); bool success = false; - if (LowerCaseEqualsASCII(ext, "png")) { + if (path.MatchesExtension(FILE_PATH_LITERAL(".png"))) { success = LoadPng(data); - } else if (LowerCaseEqualsASCII(ext, "emf")) { + } else if (path.MatchesExtension(FILE_PATH_LITERAL(".emf"))) { success = LoadMetafile(data); } else { DCHECK(false); diff --git a/printing/image.h b/printing/image.h index ed2820b..5f4746d 100644 --- a/printing/image.h +++ b/printing/image.h @@ -9,21 +9,22 @@ #include <vector> #include "base/basictypes.h" -#include "base/file_path.h" #include "base/logging.h" #include "gfx/size.h" #include "printing/native_metafile.h" +class FilePath; + namespace printing { // Lightweight raw-bitmap management. The image, once initialized, is immutable. // The main purpose is testing image contents. class Image { public: - // Creates the image from the given filename on disk. Uses extension to + // Creates the image from the given file on disk. Uses extension to // defer file type. PNG and EMF (on Windows) currently supported. // If image loading fails size().IsEmpty() will be true. - explicit Image(const std::wstring& filename); + explicit Image(const FilePath& path); // Creates the image from the metafile. Deduces bounds based on bounds in // metafile. If loading fails size().IsEmpty() will be true. diff --git a/tools/imagediff/image_diff.cc b/tools/imagediff/image_diff.cc index 7c16dcd..e629a85 100644 --- a/tools/imagediff/image_diff.cc +++ b/tools/imagediff/image_diff.cc @@ -89,7 +89,8 @@ class Image { // Creates the image from the given filename on disk, and returns true on // success. bool CreateFromFilename(const char* filename) { - FILE* f = file_util::OpenFile(std::string(filename), "rb"); + FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename)); + FILE* f = file_util::OpenFile(path, "rb"); if (!f) return false; @@ -311,7 +312,8 @@ int DiffImages(const char* file1, const char* file2, const char* out_file) { gfx::PNGCodec::Encode(diff_image.data(), gfx::PNGCodec::FORMAT_RGBA, diff_image.w(), diff_image.h(), diff_image.w() * 4, false, &png_encoding); - if (file_util::WriteFile(UTF8ToWide(out_file), + FilePath out_path = FilePath::FromWStringHack(ASCIIToWide(out_file)); + if (file_util::WriteFile(out_path, reinterpret_cast<char*>(&png_encoding.front()), png_encoding.size()) < 0) return kStatusError; diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 63de00b..a73dc95 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -325,7 +325,7 @@ void TestShell::Dump(TestShell* shell) { // static std::string TestShell::DumpImage(skia::PlatformCanvas* canvas, - const std::wstring& file_name, const std::string& pixel_hash) { + const FilePath& path, const std::string& pixel_hash) { skia::BitmapPlatformDevice& device = static_cast<skia::BitmapPlatformDevice&>(canvas->getTopPlatformDevice()); const SkBitmap& src_bmp = device.accessBitmap(false); @@ -371,7 +371,7 @@ std::string TestShell::DumpImage(skia::PlatformCanvas* canvas, static_cast<int>(src_bmp.rowBytes()), discard_transparency, &png); // Write to disk. - file_util::WriteFile(file_name, reinterpret_cast<const char *>(&png[0]), + file_util::WriteFile(path, reinterpret_cast<const char *>(&png[0]), png.size()); } @@ -692,7 +692,7 @@ void TestShell::GoBackOrForward(int offset) { } void TestShell::DumpDocumentText() { - std::wstring file_path; + FilePath file_path; if (!PromptForSaveFile(L"Dump document text", &file_path)) return; @@ -702,7 +702,7 @@ void TestShell::DumpDocumentText() { } void TestShell::DumpRenderTree() { - std::wstring file_path; + FilePath file_path; if (!PromptForSaveFile(L"Dump render tree", &file_path)) return; diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 117e2d2..8f7e60c 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -32,6 +32,7 @@ #include <list> #include "base/basictypes.h" +#include "base/file_path.h" #if defined(OS_MACOSX) #include "base/lazy_instance.h" #endif @@ -50,7 +51,6 @@ typedef std::list<gfx::NativeWindow> WindowList; struct WebPreferences; class AccessibilityController; -class FilePath; class GURL; class TestNavigationEntry; class TestNavigationController; @@ -75,7 +75,7 @@ public: bool dump_pixels; // Filename we dump pixels to (when pixel testing is enabled). - std::wstring pixel_file_name; + FilePath pixel_file_name; // The md5 hash of the bitmap dump (when pixel testing is enabled). std::string pixel_hash; // URL of the test. @@ -202,7 +202,7 @@ public: void Reload(); bool Navigate(const TestNavigationEntry& entry, bool reload); - bool PromptForSaveFile(const wchar_t* prompt_title, std::wstring* result); + bool PromptForSaveFile(const wchar_t* prompt_title, FilePath* result); std::wstring GetDocumentText(); void DumpDocumentText(); void DumpRenderTree(); @@ -262,7 +262,7 @@ public: // Writes the image captured from the given web frame to the given file. // The returned string is the ASCII-ized MD5 sum of the image. static std::string DumpImage(skia::PlatformCanvas* canvas, - const std::wstring& file_name, + const FilePath& path, const std::string& pixel_hash); static void ResetWebPreferences(); diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 92f1f19..3d08253 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -491,7 +491,8 @@ void TestShell::ResizeSubViews() { iter != TestShell::windowList()->end(); iter++) { GtkWindow* window = *iter; TestShell* shell = - static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell")); + static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), + "test-shell")); shell->DumpBackForwardList(result); } } @@ -505,7 +506,8 @@ void TestShell::ResizeSubViews() { GtkWindow* window = *(TestShell::windowList()->begin()); TestShell* shell = - static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell")); + static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), + "test-shell")); // Clear focus between tests. shell->m_focusedWidgetHost = NULL; @@ -570,9 +572,8 @@ void TestShell::LoadURLForFrame(const GURL& url, new TestNavigationEntry(-1, url, std::wstring(), frame_name)); } -// TODO(agl): PromptForSaveFile should use FilePath bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, - std::wstring* result) { + FilePath* result) { GtkWidget* dialog; dialog = gtk_file_chooser_dialog_new(WideToUTF8(prompt_title).c_str(), GTK_WINDOW(m_mainWnd), @@ -589,7 +590,7 @@ bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, } char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); gtk_widget_destroy(dialog); - *result = UTF8ToWide(path); + *result = FilePath(path); g_free(path); return true; } diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 9b9b9aa..08c1432 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -593,7 +593,7 @@ void TestShell::LoadURLForFrame(const GURL& url, } bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, - std::wstring* result) + FilePath* result) { NSSavePanel* save_panel = [NSSavePanel savePanel]; @@ -605,7 +605,7 @@ bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, /* display the NSSavePanel */ if ([save_panel runModalForDirectory:NSHomeDirectory() file:@""] == NSOKButton) { - result->assign(UTF8ToWide([[save_panel filename] UTF8String])); + *result = FilePath([[save_panel filename] fileSystemRepresentation]); return true; } return false; @@ -672,8 +672,7 @@ base::StringPiece GetDataResource(int resource_id) { // use a PNG. The GIF doesn't have the color range needed to correctly // match the TIFF they use in Safari. path = path.AppendASCII("missingImage.png"); - bool success = file_util::ReadFileToString(path.ToWStringHack(), - &broken_image_data); + bool success = file_util::ReadFileToString(path, &broken_image_data); if (!success) { LOG(FATAL) << "Failed reading: " << path.value(); } @@ -686,8 +685,7 @@ base::StringPiece GetDataResource(int resource_id) { if (resize_corner_data.empty()) { FilePath path = GetResourcesFilePath(); path = path.AppendASCII("textAreaResizeCorner.png"); - bool success = file_util::ReadFileToString(path.ToWStringHack(), - &resize_corner_data); + bool success = file_util::ReadFileToString(path, &resize_corner_data); if (!success) { LOG(FATAL) << "Failed reading: " << path.value(); } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 412cd3a..5cca69d 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -305,9 +305,9 @@ int main(int argc, char* argv[]) { if (parsed_command_line.HasSwitch(test_shell::kDumpPixels)) { // The pixel test flag also gives the image file name to use. params.dump_pixels = true; - params.pixel_file_name = parsed_command_line.GetSwitchValue( + params.pixel_file_name = parsed_command_line.GetSwitchValuePath( test_shell::kDumpPixels); - if (params.pixel_file_name.size() == 0) { + if (params.pixel_file_name.empty()) { fprintf(stderr, "No file specified for pixel tests"); exit(1); } diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index 079a830..07b9859 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -700,7 +700,7 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { } bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, - std::wstring* result) { + FilePath* result) { wchar_t path_buf[MAX_PATH] = L"data.txt"; OPENFILENAME info = {0}; @@ -714,7 +714,7 @@ bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, if (!GetSaveFileName(&info)) return false; - result->assign(info.lpstrFile); + *result = FilePath(info.lpstrFile); return true; } |