Skip to content

Commit bfc6df2

Browse files
committed
make compile on andoid ios macos PWEASE :3
1 parent 2076016 commit bfc6df2

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ so only when the user is within *all* ranges can the splash appear.
6060

6161
> [!NOTE]
6262
> For date ranges where the start of the range is *after* the end of the range,
63-
> the end of the range is assumed to be in the following year. So, `09-01 01-01`
64-
> is implcitily `09-01-CurrentYear 09-01-NextYear`
63+
> the end of the range is assumed to be in the following year. So, `09-01 08-28`
64+
> is implcitily `09-01-CurrentYear 08-28-NextYear`
6565
6666
# Contributing
6767
If you want to make this project better, just make a PR! :D

src/DateRange.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
geode::Result<> DateRange::parse(const std::string& str, size_t start)
44
{
55
std::istringstream istrs(str.substr(start));
6-
istrs
7-
>> std::chrono::parse("%m-%d", m_Start)
8-
>> std::ws
9-
>> std::chrono::parse("%m-%d", m_End);
6+
if (!(std::chrono::from_stream(istrs, "%m-%d", m_Start) &&
7+
istrs >> std::ws &&
8+
std::chrono::from_stream(istrs, "%m-%d", m_End)))
9+
{
10+
return geode::Err("Failed to parse DateRange");
11+
}
1012

1113
if (istrs.fail()) return geode::Err("Stringstream failed!");
1214
if (!m_Start.ok()) return geode::Err("Start not OK!");

src/SplashRead.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ bool SplashRead::loadFile(std::filesystem::path filePath)
1515
return false;
1616
}
1717

18-
std::optional<std::chrono::month_day> dateRangeStart = std::nullopt;
19-
std::optional<std::chrono::month_day> dateRangeEnd = std::nullopt;
20-
2118
std::string line;
2219
int lineNum = 1;
2320
while (std::getline(m_FileStream, line))
@@ -140,7 +137,7 @@ bool SplashRead::parseKeyword(const std::string& line)
140137
auto res = dr.parse(line.substr(getNextWord(line, 0)));
141138
if (!res)
142139
{
143-
log::error("Failed to parse date range: ({}{}, {}{})\n{}!", dr.getStart().month(), dr.getStart().day(), dr.getEnd().month(), dr.getEnd().day(), res.unwrapErr());
140+
log::error("Failed to parse date range! Reason: {}", res.unwrapErr());
144141
return false;
145142
}
146143

0 commit comments

Comments
 (0)