Skip to content

Commit 1cf21b2

Browse files
committed
ci: Fix CI issues
1 parent 914f252 commit 1cf21b2

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

conanfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Example(ConanFile):
1414
"libcurl/*:with_brotli": True,
1515
"libcurl/*:with_zstd": True,
1616
"libcurl/*:with_zlib": True,
17-
"libcurl/*:with_openssl": True,
17+
"libcurl/*:with_ssl": "openssl",
1818
}
1919

2020
def layout(self):
@@ -24,6 +24,10 @@ def config_options(self):
2424
if self.settings.os == "Windows":
2525
del self.options.fPIC
2626

27+
def configure(self):
28+
if self.settings.os == "Windows":
29+
self.options["libcurl/*"].with_ssl = "schannel"
30+
2731
def requirements(self):
2832
self.requires("nlohmann_json/3.12.0")
2933
self.requires("libcurl/8.18.0")

src/main.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
/**
2-
* File : main.cpp
3-
* Project : leetcode-cpp
4-
* Author : Wei Tan <tanwei.winterreise@gmail.com>
5-
* Date : 2026-02-12 15:07:32
6-
* Last Modified Date: 2026-02-12 15:46:39
7-
* Last Modified By : Wei Tan <tanwei.winterreise@gmail.com>
8-
*/
1+
#include "fetcher.h"
92

103
#include <cstdlib>
114
#include <filesystem>
@@ -18,9 +11,6 @@
1811
#include <string>
1912
#include <vector>
2013

21-
// This project headers
22-
#include "fetcher.h"
23-
2414
namespace fs = std::filesystem;
2515
using json = nlohmann::json;
2616

@@ -45,7 +35,7 @@ static void load_dotenv(const std::string& path = ".env") {
4535
continue;
4636
}
4737
if (pos != std::string::npos) {
48-
line = line.substr(0, pos);
38+
line.resize(pos);
4939
}
5040
trim(line);
5141
if (line.empty()) {
@@ -226,7 +216,7 @@ static void deal_solving(int id) {
226216
}
227217
std::string base = found.filename().string();
228218
if (base.size() > 4 && base.substr(base.size() - 4) == ".cpp") {
229-
base = base.substr(0, base.size() - 4);
219+
base.resize(base.size() - 4);
230220
}
231221
if (base.size() > 0 && base[0] == 'p') {
232222
base[0] = 's';
@@ -246,11 +236,7 @@ static void deal_problem(const fetcher::Problem& problem,
246236
fn << "p" << std::setw(4) << std::setfill('0') << problem.question_id
247237
<< "_";
248238
std::string slug = problem.title_slug;
249-
for (auto& c : slug) {
250-
if (c == '-') {
251-
c = '_';
252-
}
253-
}
239+
std::replace(slug.begin(), slug.end(), '-', '_');
254240
fn << slug;
255241
std::string file_name = fn.str();
256242
fs::path dir = "./src/problem";
@@ -355,7 +341,12 @@ int main() {
355341
if (prob->code_definition.empty()) {
356342
continue;
357343
}
358-
deal_problem(*prob, prob->code_definition[0], true);
344+
try {
345+
deal_problem(*prob, prob->code_definition[0], true);
346+
} catch (const std::exception& e) {
347+
std::cerr << "Error initializing problem " << fid << ": "
348+
<< e.what() << "\n";
349+
}
359350
}
360351
return 0;
361352
}

0 commit comments

Comments
 (0)