-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean water File(const String&) usage
Signed-off-by: falkTX <[email protected]>
- Loading branch information
Showing
15 changed files
with
81 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
/* | ||
* Carla Standalone | ||
* Copyright (C) 2011-2022 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||
*/ | ||
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <[email protected]> | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "CarlaHostImpl.hpp" | ||
|
||
|
@@ -318,9 +304,7 @@ class CarlaNSM | |
fProjectPath = projectPath; | ||
fProjectPath += ".carxp"; | ||
|
||
const String jfilename = String(CharPointer_UTF8(fProjectPath)); | ||
|
||
if (File(jfilename).existsAsFile()) | ||
if (File(fProjectPath).existsAsFile()) | ||
carla_load_project(handle, fProjectPath); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
/* | ||
* Carla Plugin Host | ||
* Copyright (C) 2011-2023 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||
*/ | ||
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <[email protected]> | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#ifndef BUILD_BRIDGE | ||
# error This file should not be compiled if not building bridge | ||
|
@@ -947,7 +933,7 @@ class CarlaEngineBridge : public CarlaEngine, | |
bigValueFilePath = bigValueFilePath.replaceSection(0, 1, "Z:\\").replace("/", "\\"); | ||
#endif | ||
|
||
File bigValueFile(bigValueFilePath); | ||
File bigValueFile(bigValueFilePath.toRawUTF8()); | ||
CARLA_SAFE_ASSERT_BREAK(bigValueFile.existsAsFile()); | ||
|
||
plugin->setCustomData(type.text, key.text, bigValueFile.loadFileAsString().toRawUTF8(), true); | ||
|
@@ -988,7 +974,7 @@ class CarlaEngineBridge : public CarlaEngine, | |
chunkFilePath = chunkFilePath.replaceSection(0, 1, "Z:\\").replace("/", "\\"); | ||
#endif | ||
|
||
File chunkFile(chunkFilePath); | ||
File chunkFile(chunkFilePath.toRawUTF8()); | ||
CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile()); | ||
|
||
String chunkDataBase64(chunkFile.loadFileAsString()); | ||
|
@@ -1122,7 +1108,7 @@ class CarlaEngineBridge : public CarlaEngine, | |
filePath += CARLA_OS_SEP_STR ".CarlaCustomData_"; | ||
filePath += fShmAudioPool.getFilenameSuffix(); | ||
|
||
if (File(filePath).replaceWithText(cdata.value)) | ||
if (File(filePath.toRawUTF8()).replaceWithText(cdata.value)) | ||
{ | ||
const uint32_t ulength(static_cast<uint32_t>(filePath.length())); | ||
|
||
|
@@ -1160,7 +1146,7 @@ class CarlaEngineBridge : public CarlaEngine, | |
filePath += CARLA_OS_SEP_STR ".CarlaChunk_"; | ||
filePath += fShmAudioPool.getFilenameSuffix(); | ||
|
||
if (File(filePath).replaceWithText(dataBase64.buffer())) | ||
if (File(filePath.toRawUTF8()).replaceWithText(dataBase64.buffer())) | ||
{ | ||
const uint32_t ulength(static_cast<uint32_t>(filePath.length())); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
/* | ||
* Carla Plugin | ||
* Copyright (C) 2011-2023 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||
*/ | ||
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <[email protected]> | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "CarlaPluginInternal.hpp" | ||
#include "CarlaEngine.hpp" | ||
|
@@ -987,8 +973,7 @@ bool CarlaPlugin::saveStateToFile(const char* const filename) | |
out << streamState; | ||
out << "</CARLA-PRESET>\n"; | ||
|
||
const String jfilename = String(CharPointer_UTF8(filename)); | ||
File file(jfilename); | ||
File file(filename); | ||
|
||
if (file.replaceWithData(out.getData(), out.getDataSize())) | ||
return true; | ||
|
@@ -1004,8 +989,7 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename) | |
CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false); | ||
carla_debug("CarlaPlugin::loadStateFromFile(\"%s\")", filename); | ||
|
||
const String jfilename = String(CharPointer_UTF8(filename)); | ||
File file(jfilename); | ||
File file(filename); | ||
CARLA_SAFE_ASSERT_RETURN(file.existsAsFile(), false); | ||
|
||
XmlDocument xml(file); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Carla Plugin Bridge | ||
* Copyright (C) 2011-2023 Filipe Coelho <[email protected]> | ||
* Copyright (C) 2011-2024 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
|
@@ -60,7 +60,7 @@ static String findWinePrefix(const String filename, const int recursionLimit = 1 | |
|
||
const String path(filename.upToLastOccurrenceOf("/", false, false)); | ||
|
||
if (File(path + "/dosdevices").isDirectory()) | ||
if (File(String(path + "/dosdevices").toRawUTF8()).isDirectory()) | ||
return path; | ||
|
||
return findWinePrefix(path, recursionLimit-1); | ||
|
@@ -204,7 +204,7 @@ class CarlaPluginBridgeThread : public CarlaThread | |
|
||
if (fBridgeBinary.endsWithIgnoreCase("64.exe") | ||
&& options.wine.executable[0] == CARLA_OS_SEP | ||
&& File(wineCMD + "64").existsAsFile()) | ||
&& File(String(wineCMD + "64").toRawUTF8()).existsAsFile()) | ||
wineCMD += "64"; | ||
} | ||
else | ||
|
@@ -996,7 +996,7 @@ class CarlaPluginBridge : public CarlaPlugin | |
filePath += CARLA_OS_SEP_STR ".CarlaCustomData_"; | ||
filePath += fShmAudioPool.getFilenameSuffix(); | ||
|
||
if (File(filePath).replaceWithText(value)) | ||
if (File(filePath.toRawUTF8()).replaceWithText(value)) | ||
{ | ||
const uint32_t ulength = static_cast<uint32_t>(filePath.length()); | ||
|
||
|
@@ -1034,7 +1034,7 @@ class CarlaPluginBridge : public CarlaPlugin | |
filePath += CARLA_OS_SEP_STR ".CarlaChunk_"; | ||
filePath += fShmAudioPool.getFilenameSuffix(); | ||
|
||
if (File(filePath).replaceWithText(dataBase64.buffer())) | ||
if (File(filePath.toRawUTF8()).replaceWithText(dataBase64.buffer())) | ||
{ | ||
const uint32_t ulength = static_cast<uint32_t>(filePath.length()); | ||
|
||
|
@@ -2550,7 +2550,7 @@ class CarlaPluginBridge : public CarlaPlugin | |
} | ||
#endif | ||
|
||
const File bigValueFile(realBigValueFilePath); | ||
const File bigValueFile(realBigValueFilePath.toRawUTF8()); | ||
CARLA_SAFE_ASSERT_BREAK(bigValueFile.existsAsFile()); | ||
|
||
CarlaPlugin::setCustomData(type.text, key.text, bigValueFile.loadFileAsString().toRawUTF8(), false); | ||
|
@@ -2591,7 +2591,7 @@ class CarlaPluginBridge : public CarlaPlugin | |
} | ||
#endif | ||
|
||
const File chunkFile(realChunkFilePath); | ||
const File chunkFile(realChunkFilePath.toRawUTF8()); | ||
CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile()); | ||
|
||
fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); | ||
|
@@ -3245,7 +3245,7 @@ class CarlaPluginBridge : public CarlaPlugin | |
filePath += CARLA_OS_SEP_STR ".CarlaChunk_"; | ||
filePath += fShmAudioPool.getFilenameSuffix(); | ||
|
||
if (File(filePath).replaceWithText(dataBase64.buffer())) | ||
if (File(filePath.toRawUTF8()).replaceWithText(dataBase64.buffer())) | ||
{ | ||
const uint32_t ulength(static_cast<uint32_t>(filePath.length())); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Carla JSFX Plugin | ||
* Copyright (C) 2021-2023 Filipe Coelho <[email protected]> | ||
* Copyright (C) 2021-2024 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
|
@@ -943,7 +943,7 @@ class CarlaPluginJSFX : public CarlaPlugin | |
// find which engine search path we're in, and use this as the root | ||
for (int i = 0; i < splitPaths.size() && !fUnit; ++i) | ||
{ | ||
const File currentPath(splitPaths[i]); | ||
const File currentPath(splitPaths[i].toRawUTF8()); | ||
if (file.isAChildOf(currentPath)) | ||
fUnit = CarlaJsfxUnit(currentPath, file); | ||
} | ||
|
@@ -957,10 +957,10 @@ class CarlaPluginJSFX : public CarlaPlugin | |
// search a matching file in plugin paths | ||
for (int i = 0; i < splitPaths.size() && !fUnit; ++i) | ||
{ | ||
const File currentPath(splitPaths[i]); | ||
const File currentPath(splitPaths[i].toRawUTF8()); | ||
const File currentFile = currentPath.getChildFile(CharPointer_UTF8(label)); | ||
const CarlaJsfxUnit currentUnit(currentPath, currentFile); | ||
if (File(currentUnit.getFilePath()).existsAsFile()) | ||
if (File(currentUnit.getFilePath().toRawUTF8()).existsAsFile()) | ||
fUnit = currentUnit; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.