Skip to content

Commit

Permalink
Allow file writes to new subdirectories in remote Storage Groups
Browse files Browse the repository at this point in the history
If the subdirectory for a file to be written does not exist, then
create the path to the subdirectory instead of failing inside the
ThreadedFileWriter.
  • Loading branch information
cpinkham committed Dec 28, 2010
1 parent 45b8f89 commit 8fdfa75
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mythtv/programs/mythbackend/mainserver.cpp
Expand Up @@ -1450,7 +1450,24 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands,
}

if (writemode)
{
QString dirPath = finfo.absolutePath();
QDir qdir(dirPath);
if (!qdir.exists())
{
if (!qdir.mkpath(dirPath))
{
VERBOSE(VB_IMPORTANT, QString("ERROR: FileTransfer "
"filename '%1' is in a subdirectory which does "
"not exist, but can not be created.")
.arg(filename));
errlist << "filetransfer_unable_to_create_subdirectory";
socket->writeStringList(errlist);
return;
}
}
ft = new FileTransfer(filename, socket, writemode);
}
else
ft = new FileTransfer(filename, socket, usereadahead, timeout_ms);

Expand Down

0 comments on commit 8fdfa75

Please sign in to comment.