summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-12-23 19:02:18 +0000
committerThomas Martitz <kugel@rockbox.org>2010-12-23 19:02:18 +0000
commit87c8be4a08b4864f0df588c80bc90586f5e512a0 (patch)
treec2265c82437eae7533569f1c6b6e254a321a06f4 /firmware/target/hosted
parente1b1183f401974700a67db76f39e2bba9a5984e1 (diff)
downloadrockbox-87c8be4a08b4864f0df588c80bc90586f5e512a0.tar.gz
rockbox-87c8be4a08b4864f0df588c80bc90586f5e512a0.zip
RaaA: Improve tagcache search to make the database built.
First, it add the ability to tagcache to walk through multiple search roots. Second, it adds symlinks targets to the search roots if they're are not inside any of the current search roots, otherwise the symlink is ignored (unless it's a file). The default search root is still /, so no search root will be actually added. But the tagcache now isn't trapped by recursive symlinks anymore and successfully builds, and it's prepared for a future music directory setting. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28884 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/android/fs-android.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/firmware/target/hosted/android/fs-android.c b/firmware/target/hosted/android/fs-android.c
index 1967198d3d..c6d22a477e 100644
--- a/firmware/target/hosted/android/fs-android.c
+++ b/firmware/target/hosted/android/fs-android.c
@@ -105,26 +105,37 @@ struct dirinfo dir_get_info(struct DIR* _parent, struct dirent *dir)
{
struct __dir *parent = (struct __dir*)_parent;
struct stat s;
- struct tm *tm;
+ struct tm *tm = NULL;
struct dirinfo ret;
char path[MAX_PATH];
snprintf(path, sizeof(path), "%s/%s", parent->path, dir->d_name);
- stat(path, &s);
memset(&ret, 0, sizeof(ret));
- if (S_ISDIR(s.st_mode))
+ if (!stat(path, &s))
{
- ret.attribute = ATTR_DIRECTORY;
+ if (S_ISDIR(s.st_mode))
+ {
+ ret.attribute = ATTR_DIRECTORY;
+ }
+ ret.size = s.st_size;
+ tm = localtime(&(s.st_mtime));
+ }
+
+ if (!lstat(path, &s) && S_ISLNK(s.st_mode))
+ {
+ ret.attribute |= ATTR_LINK;
+ }
+
+ if (tm)
+ {
+ ret.wrtdate = ((tm->tm_year - 80) << 9) |
+ ((tm->tm_mon + 1) << 5) |
+ tm->tm_mday;
+ ret.wrttime = (tm->tm_hour << 11) |
+ (tm->tm_min << 5) |
+ (tm->tm_sec >> 1);
}
- ret.size = s.st_size;
- tm = localtime(&(s.st_mtime));
- ret.wrtdate = ((tm->tm_year - 80) << 9) |
- ((tm->tm_mon + 1) << 5) |
- tm->tm_mday;
- ret.wrttime = (tm->tm_hour << 11) |
- (tm->tm_min << 5) |
- (tm->tm_sec >> 1);
return ret;
}