Skip to content

Commit a24e18e

Browse files
author
Andy Zhang
committed
Fix errors when running on Windows.
1 parent 5db2385 commit a24e18e

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

include/gui.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/**************************************************************************************************
2+
* Copyright (c) 2023-2024 NWSOFT *
3+
* *
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy *
5+
* of this software and associated documentation files (the "Software"), to deal *
6+
* in the Software without restriction, including without limitation the rights *
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
8+
* copies of the Software, and to permit persons to whom the Software is *
9+
* furnished to do so, subject to the following conditions: *
10+
* *
11+
* The above copyright notice and this permission notice shall be included in all *
12+
* copies or substantial portions of the Software. *
13+
* *
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
20+
* SOFTWARE. *
21+
**************************************************************************************************/
22+
123
#pragma once
224

325
#include "output.hpp"

src/util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ namespace steppable::__internals::numUtils
205205
negative = true;
206206
out.erase(0, 1);
207207
}
208-
while (out.front() == '0')
208+
// Remove all the leading zeros, EXCEPT the last one.
209+
while (out.front() == '0' and out.length() > 1)
209210
out.erase(0, 1);
210211

211212
if (negative)

tools/add_copyright_header.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def process(file: Path) -> None:
162162
file.suffix in (".cpp", ".hpp") # C++ Source / Header
163163
or file.name == "cpp.hint" # C++ Hint file
164164
):
165-
with open(file, "r") as f:
165+
with open(file, "r", encoding="utf-8") as f:
166166
contents = f.read()
167167
results = re.match(
168168
REGEX_CPP, first_n_lines(contents, count_lines(COPYRIGHT_CPP) + 1)
@@ -180,14 +180,14 @@ def process(file: Path) -> None:
180180
contents = contents.replace(results.group(0), header + "\n")
181181
print(f"Updated header in {file}")
182182

183-
with open(file, "w") as f:
183+
with open(file, "w", encoding="utf-8") as f:
184184
f.write(contents)
185185
elif (
186186
file.suffix == ".py"
187187
or file.name == "CMakeLists.txt"
188188
or ".stp_" in file.suffix # Steppable configuration files
189189
): # Python File or CMake file
190-
with open(file, "r") as f:
190+
with open(file, "r", encoding="utf-8") as f:
191191
contents = f.read()
192192
results = re.match(
193193
REGEX_PY_CMAKE,
@@ -206,7 +206,7 @@ def process(file: Path) -> None:
206206
contents = contents.replace(results.group(0), header + "\n")
207207
print(f"Updated header in {file}")
208208

209-
with open(file, "w") as f:
209+
with open(file, "w", encoding="utf-8") as f:
210210
f.write(contents)
211211

212212

0 commit comments

Comments
 (0)