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

Unified Diff: bin/dartutils.cc

Issue 10344010: Canonicalize the reference_dir also when canonicalizing a path (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | tests/vm/vm.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/dartutils.cc
===================================================================
--- bin/dartutils.cc (revision 7254)
+++ bin/dartutils.cc (working copy)
@@ -232,31 +232,33 @@
return strdup(filename);
}
- char* path = strdup(reference_dir);
- if (path == NULL) {
- return NULL;
+ char* canonical_path = File::GetCanonicalPath(reference_dir);
+ if (canonical_path == NULL) {
+ canonical_path = strdup(reference_dir);
+ ASSERT(canonical_path != NULL);
}
- char* path_sep = strrchr(path, File::PathSeparator()[0]);
+ ASSERT(File::PathSeparator() != NULL && strlen(File::PathSeparator()) == 1);
+ char* path_sep = strrchr(canonical_path, File::PathSeparator()[0]);
if (path_sep == NULL) {
// No separator found: Reference is a file in local directory.
+ free(canonical_path);
return strdup(filename);
}
*path_sep = '\0';
intptr_t len = snprintf(NULL, 0, "%s%s%s",
- path, File::PathSeparator(), filename);
+ canonical_path, File::PathSeparator(), filename);
char* absolute_filename = reinterpret_cast<char*>(malloc(len + 1));
ASSERT(absolute_filename != NULL);
snprintf(absolute_filename, len + 1, "%s%s%s",
- path, File::PathSeparator(), filename);
-
- free(path);
- char* canonical_filename = File::GetCanonicalPath(absolute_filename);
- if (canonical_filename == NULL) {
+ canonical_path, File::PathSeparator(), filename);
+ free(canonical_path);
+ canonical_path = File::GetCanonicalPath(absolute_filename);
+ if (canonical_path == NULL) {
return absolute_filename;
}
free(absolute_filename);
- return canonical_filename;
+ return canonical_path;
}
« no previous file with comments | « no previous file | tests/vm/vm.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698