Index: runtime/bin/directory_linux.cc |
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc |
index 3b9d01684286fc31c79d06561168d19f24364a8f..c37b58b1ebd42179b52212eb7198bd0f107deca8 100644 |
--- a/runtime/bin/directory_linux.cc |
+++ b/runtime/bin/directory_linux.cc |
@@ -80,11 +80,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())); |
@@ -94,6 +89,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_); |