From 90a61b6babe3528efd982511790057e1e1e39b81 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2015 20:42:50 +0100 Subject: fs/FileInfo: new library providing GetFileInfo() Replaces StatFile(), with a portable data object. --- src/command/FileCommands.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/command/FileCommands.cxx') diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index f1cb72c99..9f1c3a8e3 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -36,7 +36,7 @@ #include "TagFile.hxx" #include "storage/StorageInterface.hxx" #include "fs/AllocatedPath.hxx" -#include "fs/FileSystem.hxx" +#include "fs/FileInfo.hxx" #include "fs/DirectoryReader.hxx" #include "TimePrint.hxx" #include "ls.hxx" @@ -99,22 +99,22 @@ handle_listfiles_local(Client &client, const char *path_utf8) const AllocatedPath full_fs = AllocatedPath::Build(path_fs, name_fs); - struct stat st; - if (!StatFile(full_fs, st, false)) + FileInfo fi; + if (!GetFileInfo(full_fs, fi, false)) continue; - if (S_ISREG(st.st_mode)) { + if (fi.IsRegular()) client_printf(client, "file: %s\n" "size: %" PRIu64 "\n", name_utf8.c_str(), - uint64_t(st.st_size)); - } else if (S_ISDIR(st.st_mode)) + fi.GetSize()); + else if (fi.IsDirectory()) client_printf(client, "directory: %s\n", name_utf8.c_str()); else continue; - time_print(client, "Last-Modified", st.st_mtime); + time_print(client, "Last-Modified", fi.GetModificationTime()); } return CommandResult::OK; -- cgit v1.2.3