test/*: fix Windows build using class FromNarrowPath

This commit is contained in:
Max Kellermann 2020-04-02 16:40:18 +02:00
parent 4d453a8313
commit 9c66b0414a
12 changed files with 30 additions and 19 deletions

View File

@ -23,6 +23,7 @@
#include "decoder/DecoderList.hxx" #include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx" #include "decoder/DecoderPlugin.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/io/StdioOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
@ -63,7 +64,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path path = Path::FromFS(argv[1]); const FromNarrowPath path = argv[1];
const ScopeDecoderPluginsInit decoder_plugins_init({}); const ScopeDecoderPluginsInit decoder_plugins_init({});

View File

@ -29,6 +29,7 @@
#include "ConfigGlue.hxx" #include "ConfigGlue.hxx"
#include "tag/Config.hxx" #include "tag/Config.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "event/Thread.hxx" #include "event/Thread.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/PrintException.hxx" #include "util/PrintException.hxx"
@ -107,7 +108,7 @@ try {
return 1; return 1;
} }
const Path config_path = Path::FromFS(argv[1]); const FromNarrowPath config_path = argv[1];
const char *const plugin_name = argv[2]; const char *const plugin_name = argv[2];
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name); const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);

View File

@ -21,6 +21,7 @@
#include "tag/ApeLoader.hxx" #include "tag/ApeLoader.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "input/LocalOpen.hxx" #include "input/LocalOpen.hxx"
#include "util/StringView.hxx" #include "util/StringView.hxx"
@ -58,7 +59,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path path = Path::FromFS(argv[1]); const FromNarrowPath path = argv[1];
Mutex mutex; Mutex mutex;

View File

@ -18,6 +18,7 @@
*/ */
#include "fs/io/FileOutputStream.hxx" #include "fs/io/FileOutputStream.hxx"
#include "fs/NarrowPath.hxx"
#include "util/PrintException.hxx" #include "util/PrintException.hxx"
#include <unistd.h> #include <unistd.h>
@ -54,7 +55,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path path = Path::FromFS(argv[1]); const FromNarrowPath path = argv[1];
FileOutputStream fos(path); FileOutputStream fos(path);

View File

@ -28,6 +28,7 @@
#include "playlist/PlaylistRegistry.hxx" #include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx" #include "playlist/PlaylistPlugin.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/StdioOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx"
#include "thread/Cond.hxx" #include "thread/Cond.hxx"
@ -54,7 +55,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path config_path = Path::FromFS(argv[1]); const FromNarrowPath config_path = argv[1];
uri = argv[2]; uri = argv[2];
/* initialize MPD */ /* initialize MPD */

View File

@ -21,7 +21,7 @@
#include "config/Param.hxx" #include "config/Param.hxx"
#include "config/File.hxx" #include "config/File.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/Path.hxx" #include "fs/NarrowPath.hxx"
#include "util/PrintException.hxx" #include "util/PrintException.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
@ -36,7 +36,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path config_path = Path::FromFS(argv[1]); const FromNarrowPath config_path = argv[1];
const char *name = argv[2]; const char *name = argv[2];
const auto option = ParseConfigOptionName(name); const auto option = ParseConfigOptionName(name);

View File

@ -27,6 +27,7 @@
#include "tag/Handler.hxx" #include "tag/Handler.hxx"
#include "tag/Generic.hxx" #include "tag/Generic.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
@ -88,7 +89,7 @@ try {
} }
decoder_name = argv[1]; decoder_name = argv[1];
const Path path = Path::FromFS(argv[2]); const char *path = argv[2];
EventThread io_thread; EventThread io_thread;
io_thread.Start(); io_thread.Start();
@ -107,7 +108,7 @@ try {
DumpTagHandler h; DumpTagHandler h;
bool success; bool success;
try { try {
success = plugin->ScanFile(path, h); success = plugin->ScanFile(FromNarrowPath(path), h);
} catch (...) { } catch (...) {
PrintException(std::current_exception()); PrintException(std::current_exception());
success = false; success = false;
@ -117,7 +118,7 @@ try {
InputStreamPtr is; InputStreamPtr is;
if (!success && plugin->scan_stream != NULL) { if (!success && plugin->scan_stream != NULL) {
is = InputStream::OpenReady(path.c_str(), mutex); is = InputStream::OpenReady(path, mutex);
success = plugin->ScanStream(*is, h); success = plugin->ScanStream(*is, h);
} }
@ -130,7 +131,7 @@ try {
if (is) if (is)
ScanGenericTags(*is, h); ScanGenericTags(*is, h);
else else
ScanGenericTags(path, h); ScanGenericTags(FromNarrowPath(path), h);
} }
return 0; return 0;

View File

@ -26,6 +26,7 @@
#include "input/Init.hxx" #include "input/Init.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "util/OptionDef.hxx" #include "util/OptionDef.hxx"
#include "util/OptionParser.hxx" #include "util/OptionParser.hxx"
@ -44,7 +45,7 @@ struct CommandLine {
const char *decoder = nullptr; const char *decoder = nullptr;
const char *uri = nullptr; const char *uri = nullptr;
Path config_path = nullptr; FromNarrowPath config_path;
bool verbose = false; bool verbose = false;
}; };
@ -68,7 +69,7 @@ ParseCommandLine(int argc, char **argv)
while (auto o = option_parser.Next()) { while (auto o = option_parser.Next()) {
switch (Option(o.index)) { switch (Option(o.index)) {
case OPTION_CONFIG: case OPTION_CONFIG:
c.config_path = Path::FromFS(o.value); c.config_path = o.value;
break; break;
case OPTION_VERBOSE: case OPTION_VERBOSE:
@ -118,7 +119,7 @@ try {
DumpDecoderClient client; DumpDecoderClient client;
if (plugin->file_decode != nullptr) { if (plugin->file_decode != nullptr) {
try { try {
plugin->FileDecode(client, Path::FromFS(c.uri)); plugin->FileDecode(client, FromNarrowPath(c.uri));
} catch (StopDecoder) { } catch (StopDecoder) {
} }
} else if (plugin->stream_decode != nullptr) { } else if (plugin->stream_decode != nullptr) {

View File

@ -19,6 +19,7 @@
#include "ConfigGlue.hxx" #include "ConfigGlue.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "AudioParser.hxx" #include "AudioParser.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "filter/LoadOne.hxx" #include "filter/LoadOne.hxx"
@ -68,7 +69,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path config_path = Path::FromFS(argv[1]); const FromNarrowPath config_path = argv[1];
AudioFormat audio_format(44100, SampleFormat::S16, 2); AudioFormat audio_format(44100, SampleFormat::S16, 2);

View File

@ -20,6 +20,7 @@
#include "fs/io/GunzipReader.hxx" #include "fs/io/GunzipReader.hxx"
#include "fs/io/FileReader.hxx" #include "fs/io/FileReader.hxx"
#include "fs/io/StdioOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx"
#include "fs/NarrowPath.hxx"
#include "util/PrintException.hxx" #include "util/PrintException.hxx"
#include <stdio.h> #include <stdio.h>
@ -62,7 +63,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
Path path = Path::FromFS(argv[1]); FromNarrowPath path = argv[1];
CopyGunzip(stdout, path); CopyGunzip(stdout, path);
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -32,6 +32,7 @@
#include "Log.hxx" #include "Log.hxx"
#include "LogBackend.hxx" #include "LogBackend.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/StdioOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
@ -51,7 +52,7 @@
struct CommandLine { struct CommandLine {
const char *uri = nullptr; const char *uri = nullptr;
Path config_path = nullptr; FromNarrowPath config_path;
bool verbose = false; bool verbose = false;
@ -79,7 +80,7 @@ ParseCommandLine(int argc, char **argv)
while (auto o = option_parser.Next()) { while (auto o = option_parser.Next()) {
switch (Option(o.index)) { switch (Option(o.index)) {
case OPTION_CONFIG: case OPTION_CONFIG:
c.config_path = Path::FromFS(o.value); c.config_path = o.value;
break; break;
case OPTION_VERBOSE: case OPTION_VERBOSE:

View File

@ -23,6 +23,7 @@
#include "ConfigGlue.hxx" #include "ConfigGlue.hxx"
#include "event/Thread.hxx" #include "event/Thread.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "AudioParser.hxx" #include "AudioParser.hxx"
#include "pcm/PcmConvert.hxx" #include "pcm/PcmConvert.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
@ -111,7 +112,7 @@ try {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
const Path config_path = Path::FromFS(argv[1]); const FromNarrowPath config_path = argv[1];
AudioFormat audio_format(44100, SampleFormat::S16, 2); AudioFormat audio_format(44100, SampleFormat::S16, 2);