mpd/src/fs/LookupFile.hxx

41 lines
1.1 KiB
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
2008-12-16 21:42:34 +01:00
#ifndef MPD_LOOKUP_FILE_HXX
#define MPD_LOOKUP_FILE_HXX
2008-12-16 21:42:34 +01:00
#include "AllocatedPath.hxx"
struct ArchiveLookupResult {
2019-06-15 13:54:41 +02:00
AllocatedPath archive = nullptr;
AllocatedPath inside = nullptr;
2019-06-15 13:54:41 +02:00
operator bool() const noexcept {
return !archive.IsNull();
}
};
/**
*
* archive_lookup is used to determine if part of pathname refers to an regular
* file (archive). If so then its also used to split pathname into archive file
* and path used to locate file in archive.
* How it works:
* We do stat of the parent of input pathname as long as we find an regular file
* Normally this should never happen. When routine returns true pathname modified
* and split into archive and inpath. Otherwise nothing happens
2008-12-16 21:42:34 +01:00
*
* For example:
*
* /music/path/Talco.zip/Talco - Combat Circus/12 - A la pachenka.mp3
* is split into archive: /music/path/Talco.zip
* inarchive pathname: Talco - Combat Circus/12 - A la pachenka.mp3
2019-05-31 18:52:11 +02:00
*
* Throws on error.
2008-12-16 21:42:34 +01:00
*/
ArchiveLookupResult
LookupFile(Path pathname);
2008-12-16 21:42:34 +01:00
#endif