storage/nfs: move code to UriToNfsPath()
This commit is contained in:
parent
cf06ba6d13
commit
142d1951d2
@ -79,6 +79,17 @@ public:
|
|||||||
virtual const char *MapToRelativeUTF8(const char *uri_utf8) const override;
|
virtual const char *MapToRelativeUTF8(const char *uri_utf8) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::string
|
||||||
|
UriToNfsPath(const char *uri_utf8)
|
||||||
|
{
|
||||||
|
std::string path(uri_utf8);
|
||||||
|
|
||||||
|
/* libnfs paths must begin with a slash */
|
||||||
|
path.insert(path.begin(), '/');
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
NfsStorage::MapUTF8(const char *uri_utf8) const
|
NfsStorage::MapUTF8(const char *uri_utf8) const
|
||||||
{
|
{
|
||||||
@ -124,9 +135,7 @@ bool
|
|||||||
NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
|
NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
|
||||||
FileInfo &info, Error &error)
|
FileInfo &info, Error &error)
|
||||||
{
|
{
|
||||||
/* libnfs paths must begin with a slash */
|
const std::string path = UriToNfsPath(uri_utf8);
|
||||||
std::string path(uri_utf8);
|
|
||||||
path.insert(path.begin(), '/');
|
|
||||||
|
|
||||||
return ::GetInfo(ctx, path.c_str(), info, error);
|
return ::GetInfo(ctx, path.c_str(), info, error);
|
||||||
}
|
}
|
||||||
@ -134,9 +143,7 @@ NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
|
|||||||
StorageDirectoryReader *
|
StorageDirectoryReader *
|
||||||
NfsStorage::OpenDirectory(const char *uri_utf8, Error &error)
|
NfsStorage::OpenDirectory(const char *uri_utf8, Error &error)
|
||||||
{
|
{
|
||||||
/* libnfs paths must begin with a slash */
|
const std::string path = UriToNfsPath(uri_utf8);
|
||||||
std::string path(uri_utf8);
|
|
||||||
path.insert(path.begin(), '/');
|
|
||||||
|
|
||||||
nfsdir *dir;
|
nfsdir *dir;
|
||||||
int result = nfs_opendir(ctx, path.c_str(), &dir);
|
int result = nfs_opendir(ctx, path.c_str(), &dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user