Index: runtime/bin/directory_android.cc |
diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc |
index 02f841deb3321318fc8ad505a82cb2bec7f94149..e89dd058bea9a20daee461b01b0c1b0d7ec0d264 100644 |
--- a/runtime/bin/directory_android.cc |
+++ b/runtime/bin/directory_android.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_); |