Index: runtime/bin/directory_macos.cc |
diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc |
index feb9a9ca8dec1a7045eaac9bef0a6badd322c3e2..94b495d7e466df7af32c5c68e715d7f5fcd57f03 100644 |
--- a/runtime/bin/directory_macos.cc |
+++ b/runtime/bin/directory_macos.cc |
@@ -79,11 +79,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { |
} |
if (lister_ == 0) { |
- if (!listing->path_buffer().Add(File::PathSeparator())) { |
- done_ = true; |
- return kListError; |
- } |
- path_length_ = listing->path_buffer().length(); |
do { |
lister_ = reinterpret_cast<intptr_t>( |
opendir(listing->path_buffer().AsString())); |
@@ -93,6 +88,12 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { |
done_ = true; |
return kListError; |
} |
+ if (parent_ != NULL) { |
+ if (!listing->path_buffer().Add(File::PathSeparator())) { |
+ return kListError; |
+ } |
+ } |
+ path_length_ = listing->path_buffer().length(); |
} |
// Reset. |
listing->path_buffer().Reset(path_length_); |