Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: runtime/bin/directory_win.cc

Issue 1194883002: Improve the encoding/decoding to/from system encoding on Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments from lrn@ Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/extensions_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index e7cd89531b9f95f350647fefcebae308576d9107..40bfb9bf158ddf36b53217204bf56c9589a373c1 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -8,6 +8,7 @@
#include "bin/directory.h"
#include "bin/file.h"
#include "bin/utils.h"
+#include "bin/utils_win.h"
#include <errno.h> // NOLINT
#include <sys/stat.h> // NOLINT
@@ -26,7 +27,7 @@ PathBuffer::PathBuffer() : length_(0) {
}
char* PathBuffer::AsString() const {
- return StringUtils::WideToUtf8(AsStringW());
+ return StringUtilsWin::WideToUtf8(AsStringW());
}
wchar_t* PathBuffer::AsStringW() const {
@@ -34,7 +35,7 @@ wchar_t* PathBuffer::AsStringW() const {
}
bool PathBuffer::Add(const char* name) {
- const wchar_t* wide_name = StringUtils::Utf8ToWide(name);
+ const wchar_t* wide_name = StringUtilsWin::Utf8ToWide(name);
bool success = AddW(wide_name);
free(const_cast<wchar_t*>(wide_name));
return success;
@@ -352,7 +353,7 @@ static Directory::ExistsResult ExistsHelper(const wchar_t* dir_name) {
Directory::ExistsResult Directory::Exists(const char* dir_name) {
- const wchar_t* system_name = StringUtils::Utf8ToWide(dir_name);
+ const wchar_t* system_name = StringUtilsWin::Utf8ToWide(dir_name);
Directory::ExistsResult result = ExistsHelper(system_name);
free(const_cast<wchar_t*>(system_name));
return result;
@@ -364,14 +365,14 @@ char* Directory::Current() {
if (length == 0) return NULL;
wchar_t* current = new wchar_t[length + 1];
GetCurrentDirectoryW(length + 1, current);
- char* result = StringUtils::WideToUtf8(current);
+ char* result = StringUtilsWin::WideToUtf8(current);
delete[] current;
return result;
}
bool Directory::SetCurrent(const char* path) {
- const wchar_t* system_path = StringUtils::Utf8ToWide(path);
+ const wchar_t* system_path = StringUtilsWin::Utf8ToWide(path);
bool result = SetCurrentDirectoryW(system_path) != 0;
free(const_cast<wchar_t*>(system_path));
return result;
@@ -379,7 +380,7 @@ bool Directory::SetCurrent(const char* path) {
bool Directory::Create(const char* dir_name) {
- const wchar_t* system_name = StringUtils::Utf8ToWide(dir_name);
+ const wchar_t* system_name = StringUtilsWin::Utf8ToWide(dir_name);
int create_status = CreateDirectoryW(system_name, NULL);
// If the directory already existed, treat it as a success.
if (create_status == 0 &&
@@ -408,7 +409,7 @@ char* Directory::CreateTemp(const char* prefix) {
// descriptor inherited from its parent directory.
// The return value must be freed by the caller.
PathBuffer path;
- const wchar_t* system_prefix = StringUtils::Utf8ToWide(prefix);
+ const wchar_t* system_prefix = StringUtilsWin::Utf8ToWide(prefix);
path.AddW(system_prefix);
free(const_cast<wchar_t*>(system_prefix));
@@ -441,7 +442,7 @@ char* Directory::CreateTemp(const char* prefix) {
bool Directory::Delete(const char* dir_name, bool recursive) {
bool result = false;
- const wchar_t* system_dir_name = StringUtils::Utf8ToWide(dir_name);
+ const wchar_t* system_dir_name = StringUtilsWin::Utf8ToWide(dir_name);
if (!recursive) {
if (File::GetType(dir_name, true) == File::kIsDirectory) {
result = (RemoveDirectoryW(system_dir_name) != 0);
@@ -460,8 +461,8 @@ bool Directory::Delete(const char* dir_name, bool recursive) {
bool Directory::Rename(const char* path, const char* new_path) {
- const wchar_t* system_path = StringUtils::Utf8ToWide(path);
- const wchar_t* system_new_path = StringUtils::Utf8ToWide(new_path);
+ const wchar_t* system_path = StringUtilsWin::Utf8ToWide(path);
+ const wchar_t* system_new_path = StringUtilsWin::Utf8ToWide(new_path);
ExistsResult exists = ExistsHelper(system_path);
if (exists != EXISTS) return false;
ExistsResult new_exists = ExistsHelper(system_new_path);
« no previous file with comments | « no previous file | runtime/bin/extensions_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698