Commit 1de5aa98 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

fs: Don't use 'path' when an MRL is expected

parent 74837a40
......@@ -79,10 +79,13 @@ namespace fs
virtual std::shared_ptr<fs::IDevice> createDevice( const std::string& uuid ) = 0;
///
/// \brief createDeviceFromPath creates a representation of a device
/// \param path A path.
/// \param path An MRL.
/// \return A representation of the device.
///
virtual std::shared_ptr<fs::IDevice> createDeviceFromMrl( const std::string& path ) = 0;
/// The provided path can and most often will refer to a file in that
/// device, and will not simply be the path to the device mountpoint
///
virtual std::shared_ptr<fs::IDevice> createDeviceFromMrl( const std::string& mrl ) = 0;
///
/// \brief refresh Will cause any FS cache to be refreshed.
///
......
......@@ -55,9 +55,9 @@ NetworkFileSystemFactory::NetworkFileSystemFactory(const std::string& protocol,
em.onItemDeleted( [this]( VLC::MediaPtr m, int ) { onDeviceRemoved( std::move( m ) ); } );
}
std::shared_ptr<fs::IDirectory> NetworkFileSystemFactory::createDirectory( const std::string& path )
std::shared_ptr<fs::IDirectory> NetworkFileSystemFactory::createDirectory( const std::string& mrl )
{
return std::make_shared<fs::NetworkDirectory>( path, *this );
return std::make_shared<fs::NetworkDirectory>( mrl, *this );
}
std::shared_ptr<fs::IDevice> NetworkFileSystemFactory::createDevice( const std::string& mrl )
......@@ -77,13 +77,13 @@ std::shared_ptr<fs::IDevice> NetworkFileSystemFactory::createDevice( const std::
return res;
}
std::shared_ptr<fs::IDevice> NetworkFileSystemFactory::createDeviceFromMrl( const std::string& path )
std::shared_ptr<fs::IDevice> NetworkFileSystemFactory::createDeviceFromMrl( const std::string& mrl )
{
std::shared_ptr<fs::IDevice> res;
std::unique_lock<compat::Mutex> lock( m_devicesLock );
m_deviceCond.wait_for( lock, std::chrono::seconds{ 5 }, [this, &res, &path]() {
auto it = std::find_if( begin( m_devices ), end( m_devices ), [&path]( const Device& d ) {
return strncasecmp( path.c_str(), d.mrl.c_str(), d.mrl.length() ) == 0;
m_deviceCond.wait_for( lock, std::chrono::seconds{ 5 }, [this, &res, &mrl]() {
auto it = std::find_if( begin( m_devices ), end( m_devices ), [&mrl]( const Device& d ) {
return strncasecmp( mrl.c_str(), d.mrl.c_str(), d.mrl.length() ) == 0;
});
if ( it == end( m_devices ) )
return false;
......
......@@ -43,9 +43,9 @@ public:
* @param protocol The protocol name
*/
NetworkFileSystemFactory( const std::string& protocol, const std::string& name );
virtual std::shared_ptr<fs::IDirectory> createDirectory( const std::string& path ) override;
virtual std::shared_ptr<fs::IDirectory> createDirectory( const std::string& mrl ) override;
virtual std::shared_ptr<fs::IDevice> createDevice( const std::string& uuid ) override;
virtual std::shared_ptr<fs::IDevice> createDeviceFromMrl( const std::string& path ) override;
virtual std::shared_ptr<fs::IDevice> createDeviceFromMrl( const std::string& mrl ) override;
virtual void refreshDevices() override;
virtual bool isMrlSupported( const std::string& path ) const override;
virtual bool isNetworkFileSystem() const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment