mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
New audio player done (without playlist).
This commit is contained in:
@@ -27,8 +27,10 @@ namespace codegen {
|
||||
namespace common {
|
||||
namespace {
|
||||
|
||||
QString WorkingPath = ".";
|
||||
|
||||
std::string relativeLocalPath(const QString &filepath) {
|
||||
auto name = QFile::encodeName(QDir().relativeFilePath(filepath));
|
||||
auto name = QFile::encodeName(QDir(WorkingPath).relativeFilePath(filepath));
|
||||
return name.constData();
|
||||
}
|
||||
|
||||
@@ -43,5 +45,9 @@ LogStream logError(int code, const QString &filepath, int line) {
|
||||
return LogStream(std::cerr);
|
||||
}
|
||||
|
||||
void logSetWorkingPath(const QString &workingpath) {
|
||||
WorkingPath = workingpath;
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace codegen
|
@@ -72,6 +72,8 @@ LogStream operator<<(LogStream &&stream, T &&value) {
|
||||
// logError(kErrorFileTooLarge, filepath) << "file too large, size=" << size;
|
||||
LogStream logError(int code, const QString &filepath, int line = 0);
|
||||
|
||||
void logSetWorkingPath(const QString &workingpath);
|
||||
|
||||
static constexpr int kErrorInternal = 666;
|
||||
|
||||
} // namespace common
|
||||
|
@@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include <ostream>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include "codegen/common/logging.h"
|
||||
|
||||
namespace codegen {
|
||||
@@ -32,6 +33,7 @@ constexpr int kErrorIncludePathExpected = 901;
|
||||
constexpr int kErrorOutputPathExpected = 902;
|
||||
constexpr int kErrorInputPathExpected = 903;
|
||||
constexpr int kErrorSingleInputPathExpected = 904;
|
||||
constexpr int kErrorWorkingPathExpected = 905;
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -77,6 +79,17 @@ Options parseOptions() {
|
||||
} else if (arg.startsWith("-o")) {
|
||||
result.outputPath = arg.mid(2);
|
||||
|
||||
// Working path
|
||||
} else if (arg == "-w") {
|
||||
if (++i == count) {
|
||||
logError(kErrorWorkingPathExpected, "Command Line") << "working path expected after -w";
|
||||
return Options();
|
||||
} else {
|
||||
common::logSetWorkingPath(args.at(i));
|
||||
}
|
||||
} else if (arg.startsWith("-w")) {
|
||||
common::logSetWorkingPath(arg.mid(2));
|
||||
|
||||
// Input path
|
||||
} else {
|
||||
if (result.inputPath.isEmpty()) {
|
||||
|
Reference in New Issue
Block a user