mirror of
https://github.com/vale981/tdesktop
synced 2025-03-07 02:31:41 -05:00
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop into dev
This commit is contained in:
commit
6a0ee57054
1 changed files with 15 additions and 12 deletions
|
@ -49,12 +49,13 @@ bool do_mkdir(const char *path) { // from http://stackoverflow.com/questions/675
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _debug = false;
|
bool _debug = false;
|
||||||
|
string exeName, exeDir, workDir;
|
||||||
|
|
||||||
FILE *_logFile = 0;
|
FILE *_logFile = 0;
|
||||||
void openLog() {
|
void openLog() {
|
||||||
if (!_debug || _logFile) return;
|
if (!_debug || _logFile) return;
|
||||||
|
|
||||||
if (!do_mkdir("DebugLogs")) {
|
if (!do_mkdir((workDir + "DebugLogs").c_str())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ void openLog() {
|
||||||
|
|
||||||
static const int maxFileLen = 65536;
|
static const int maxFileLen = 65536;
|
||||||
char logName[maxFileLen];
|
char logName[maxFileLen];
|
||||||
sprintf(logName, "DebugLogs/%04d%02d%02d_%02d%02d%02d_upd.txt",
|
sprintf(logName, "%sDebugLogs/%04d%02d%02d_%02d%02d%02d_upd.txt", workDir.c_str(),
|
||||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
_logFile = fopen(logName, "w");
|
_logFile = fopen(logName, "w");
|
||||||
}
|
}
|
||||||
|
@ -192,8 +193,6 @@ bool mkpath(const char *path) {
|
||||||
return do_mkdir(path);
|
return do_mkdir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
string exeName, exeDir, workDir;
|
|
||||||
|
|
||||||
bool equal(string a, string b) {
|
bool equal(string a, string b) {
|
||||||
std::transform(a.begin(), a.end(), a.begin(), ::tolower);
|
std::transform(a.begin(), a.end(), a.begin(), ::tolower);
|
||||||
std::transform(b.begin(), b.end(), b.begin(), ::tolower);
|
std::transform(b.begin(), b.end(), b.begin(), ::tolower);
|
||||||
|
@ -204,7 +203,7 @@ void delFolder() {
|
||||||
string delPathOld = workDir + "tupdates/ready", delPath = workDir + "tupdates/temp", delFolder = workDir + "tupdates";
|
string delPathOld = workDir + "tupdates/ready", delPath = workDir + "tupdates/temp", delFolder = workDir + "tupdates";
|
||||||
writeLog("Fully clearing old path '%s'..", delPathOld.c_str());
|
writeLog("Fully clearing old path '%s'..", delPathOld.c_str());
|
||||||
if (!remove_directory(delPathOld)) {
|
if (!remove_directory(delPathOld)) {
|
||||||
writeLog("Error: failed to clear old path! :(");
|
writeLog("Failed to clear old path! :( New path was used?..");
|
||||||
}
|
}
|
||||||
writeLog("Fully clearing path '%s'..", delPath.c_str());
|
writeLog("Fully clearing path '%s'..", delPath.c_str());
|
||||||
if (!remove_directory(delPath)) {
|
if (!remove_directory(delPath)) {
|
||||||
|
@ -221,8 +220,10 @@ bool update() {
|
||||||
FILE *readyFile = fopen(readyFilePath.c_str(), "rb");
|
FILE *readyFile = fopen(readyFilePath.c_str(), "rb");
|
||||||
if (readyFile) {
|
if (readyFile) {
|
||||||
fclose(readyFile);
|
fclose(readyFile);
|
||||||
|
writeLog("Ready file found! Using new path '%s'..", updDir.c_str());
|
||||||
} else {
|
} else {
|
||||||
updDir = workDir + "tupdates/ready"; // old
|
updDir = workDir + "tupdates/ready"; // old
|
||||||
|
writeLog("Ready file not found! Using old path '%s'..", updDir.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,10 +316,6 @@ bool update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
openLog();
|
|
||||||
|
|
||||||
writeLog("Updater started..");
|
|
||||||
|
|
||||||
bool needupdate = true, autostart = false, debug = false, tosettings = false, startintray = false, testmode = false;
|
bool needupdate = true, autostart = false, debug = false, tosettings = false, startintray = false, testmode = false;
|
||||||
|
|
||||||
char *key = 0;
|
char *key = 0;
|
||||||
|
@ -342,6 +339,12 @@ int main(int argc, char *argv[]) {
|
||||||
workDir = argv[i];
|
workDir = argv[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
openLog();
|
||||||
|
|
||||||
|
writeLog("Updater started..");
|
||||||
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
writeLog("Argument: '%s'", argv[i]);
|
||||||
|
}
|
||||||
if (needupdate) writeLog("Need to update!");
|
if (needupdate) writeLog("Need to update!");
|
||||||
if (autostart) writeLog("From autostart!");
|
if (autostart) writeLog("From autostart!");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue