diff --git a/src/Folder.cpp b/src/Folder.cpp index 76076d5042cb1444bbeeed63a9c4f509917440a5..62a7a1f0e0a2a547542793ca5fcb0c742c252e6f 100644 --- a/src/Folder.cpp +++ b/src/Folder.cpp @@ -64,12 +64,12 @@ Folder::Folder( MediaLibraryPtr ml, sqlite::Row& row ) assert( row.hasRemainingColumns() == false ); } -Folder::Folder(MediaLibraryPtr ml, const std::string& path, +Folder::Folder(MediaLibraryPtr ml, const std::string& path, std::string name, int64_t parent, int64_t deviceId, bool isRemovable ) : m_ml( ml ) , m_id( 0 ) , m_path( path ) - , m_name( utils::url::decode( utils::file::directoryName( path ) ) ) + , m_name( std::move( name ) ) , m_parent( parent ) , m_isBanned( false ) , m_deviceId( deviceId ) @@ -400,12 +400,13 @@ std::shared_ptr Folder::create( MediaLibraryPtr ml, const std::string& m fs::IDevice& deviceFs ) { std::string path; + std::string name = utils::url::decode( utils::file::directoryName( mrl ) ); if ( device.isRemovable() == true ) path = deviceFs.relativeMrl( mrl ); else path = mrl; - auto self = std::make_shared( ml, path, parentId, device.id(), - deviceFs.isRemovable() ); + auto self = std::make_shared( ml, path, std::move( name ), parentId, + device.id(), deviceFs.isRemovable() ); static const std::string req = "INSERT INTO " + Folder::Table::Name + "(path, name, parent_id, device_id, is_removable) VALUES(?, ?, ?, ?, ?)"; if ( insert( ml, self, req, path, self->m_name, sqlite::ForeignKey( parentId ), diff --git a/src/Folder.h b/src/Folder.h index aa400f5745f692f37453ba4e8c55eeb8b9c949d7..29f24ce130921d3c27e216aa1faffda9a2effc94 100644 --- a/src/Folder.h +++ b/src/Folder.h @@ -93,7 +93,7 @@ public: }; Folder( MediaLibraryPtr ml, sqlite::Row& row ); - Folder( MediaLibraryPtr ml, const std::string& path, int64_t parent, + Folder(MediaLibraryPtr ml, const std::string& path, std::string name, int64_t parent, int64_t deviceId , bool isRemovable ); static void createTable( sqlite::Connection* connection );