Fix local file path writing

This commit is contained in:
Thulinma 2023-07-17 14:46:30 +02:00
parent b7d5964512
commit 9a599a06de
2 changed files with 6 additions and 5 deletions

View file

@ -274,13 +274,14 @@ namespace Util{
}else{
int flags = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
int mode = O_RDWR | O_CREAT | (append ? O_APPEND : O_TRUNC);
if (!Util::createPathFor(uri)){
ERROR_MSG("Cannot not create file %s: could not create parent folder", uri.c_str());
std::string path = target.getFilePath();
if (!Util::createPathFor(path)){
ERROR_MSG("Cannot not create file %s: could not create parent folder", path.c_str());
return false;
}
outFile = open(uri.c_str(), mode, flags);
outFile = open(path.c_str(), mode, flags);
if (outFile < 0){
ERROR_MSG("Failed to open file %s, error: %s", uri.c_str(), strerror(errno));
ERROR_MSG("Failed to open file %s, error: %s", path.c_str(), strerror(errno));
return false;
}
}

View file

@ -615,7 +615,7 @@ namespace Mist{
timer = Util::getMicros(timer);
INFO_MSG("Created header in %.3f ms (%zu tracks)", (double)timer/1000.0, M?M.trackCount():(size_t)0);
//Write header to file for caching purposes
M.toFile(HTTP::localURIResolver().link(config->getString("input") + ".dtsh").getUrl());
M.toFile(config->getString("input") + ".dtsh");
}
postHeader();
if (config->getBool("headeronly")){return 0;}