src/FileAttributeFinder.h
branchv_0
changeset 60 bb7ca5891755
parent 44 dc5c210295d0
equal deleted inserted replaced
59:7471529c0d11 60:bb7ca5891755
    53 		else if (fs::is_character_file(file)) return L"c";
    53 		else if (fs::is_character_file(file)) return L"c";
    54 		else return L"o";
    54 		else return L"o";
    55 	}
    55 	}
    56 
    56 
    57 	void fetchOwner(const fs::path& file, string_t& owner, string_t& group) {
    57 	void fetchOwner(const fs::path& file, string_t& owner, string_t& group) {
    58 		// TODO: throw exception on error
       
    59 		// TODO: get user and group in C++ way?
       
    60 		struct stat info;
    58 		struct stat info;
    61 		stat(file.c_str(), &info);
    59 		int result = ::stat(file.c_str(), &info);
       
    60 		if (result) throw RelpipeWriterException(L"Unable to stat() file „" + file.wstring() + L"“ in fetchOwner(). Result: " + std::to_wstring(result));
    62 		/**
    61 		/**
    63 		 * The return value may point to a static area, and may  be
    62 		 * The return value may point to a static area, and may  be
    64 		 * overwritten  by  subsequent calls to getpwent(3), getpw‐
    63 		 * overwritten  by  subsequent calls to getpwent(3), getpw‐
    65 		 * nam(), or getpwuid().  (Do not pass the returned pointer
    64 		 * nam(), or getpwuid().  (Do not pass the returned pointer
    66 		 * to free(3).)
    65 		 * to free(3).)