Skip to content

Commit

Permalink
Merge pull request #4 from bialger/deadline_0
Browse files Browse the repository at this point in the history
New version
  • Loading branch information
bialger authored Jul 29, 2024
2 parents 5a39514 + e80d911 commit 66b6ec3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
fail-fast: false
matrix:
config:
# - {
# name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "cl", cxx: "cl",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
# }
- {
name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
os: windows-latest,
build_type: "Release", cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
# - {
# name: "Windows Latest MinGW", artifact: "Windows-MinGW.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "gcc", cxx: "g++"
# } # some fatal errors using MinGw; MSVC - ok
# }
- {
name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz",
os: ubuntu-latest,
Expand Down Expand Up @@ -58,6 +58,8 @@ jobs:
shell: bash
run: |
if [ "${{ matrix.config.cxx }}" == "g++" ]; then
git config pack.windowMemory 10m
git config pack.windowMemory 10m
cmake -S . -B cmake-build-release -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=Release -DGTEST_RELATIVE_DIR=lib -DTERMINAL_EMULATOR=bash -G "Unix Makefiles"
cmake -S . -B cmake-build-debug -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=Debug -DGTEST_RELATIVE_DIR=lib -DTERMINAL_EMULATOR=bash -G "Unix Makefiles"
else
Expand Down Expand Up @@ -100,7 +102,6 @@ jobs:
./weather-forecast_tests_.exe
else
cd Debug
./weather-forecast_tests.exe
fi
else
cd tests
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)

project(
weather-forecast
VERSION 1.1
VERSION 1.2
DESCRIPTION "Console weather forecast app that uses OpenMeteo and Yandex Geocoder API"
LANGUAGES CXX
)
Expand All @@ -12,7 +12,6 @@ set(CMAKE_CXX_STANDARD 20)
if (WIN32) # Install dlls in the same directory as the executable on Windows
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_BUILD_TYPE Debug) # Release configuration fails to build
endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@
1. 20.02.24 0.85
2. 27.02.24 0.65
3. 05.03.24 0.5

9 changes: 7 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ "x$SAVE_PREV" = "x" ]; then
fi

EXEC_EXTENSION=".exe"
EXEC_PATH="$CMAKE_PROJECT_DIR/Debug/$PROJECT_NAME$EXEC_EXTENSION"
EXEC_PATH="$CMAKE_PROJECT_DIR/$PROJECT_NAME$EXEC_EXTENSION"

if [ "$OS_NAME" = "Linux" ]; then
EXEC_EXTENSION=".run"
Expand All @@ -30,7 +30,7 @@ fi

EXEC_LINK_PATH="$HOME/$PROJECT_NAME$EXEC_EXTENSION"

if (cmake -S . -B "$CMAKE_PROJECT_DIR" -DCMAKE_BUILD_TYPE=Release && cmake --build "$CMAKE_PROJECT_DIR" --target "$PROJECT_NAME"); then
if (cmake -S . -B "$CMAKE_PROJECT_DIR" -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" && cmake --build "$CMAKE_PROJECT_DIR" --target "$PROJECT_NAME"); then
printf 'Enter your Yandex Geocoder API key: ' && read -r API_KEY && echo "$API_KEY" > "$LOCAL_CONFIG_DIR/yandex_api_key.apikey"

if [ "x$SAVE_PREV" = "x" ]; then
Expand Down Expand Up @@ -82,6 +82,11 @@ if (cmake -S . -B "$CMAKE_PROJECT_DIR" -DCMAKE_BUILD_TYPE=Release && cmake --bui
echo "Run utility with $EXEC_LINK_PATH"
fi

exit 0
elif (cd "$CMAKE_PROJECT_DIR" && "./$PROJECT_NAME$EXEC_EXTENSION" -h >/dev/null 2>/dev/null); then
echo "Congratulations! $PROJECT_NAME was compiled successfully. But it is impossible to create a link to it - run it from $CMAKE_BUILD_DIR as .\\$PROJECT_NAME$EXEC_EXTENSION"
echo ''
cd "$CMAKE_PROJECT_DIR" && "./$PROJECT_NAME$EXEC_EXTENSION" -h
exit 0
else
echo 'Oops! Could not execute the program.'
Expand Down
13 changes: 9 additions & 4 deletions lib/ui/TextUserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,15 @@ std::vector<std::string> TextUserInterface::GetPotentialConfigDirectories() {
}

if (IsWindows()) {
std::string home_path_cmd = std::getenv("userprofile");
std::string home_path_shell = std::getenv("HOME");
potential_config_dirs.push_back(home_path_cmd + "/.config/weather-forecast");
potential_config_dirs.push_back(home_path_shell + "/.config/weather-forecast");
try {
std::string home_path_cmd = std::getenv("userprofile");
potential_config_dirs.push_back(home_path_cmd + "/.config/weather-forecast");
} catch (const std::exception&) {}

try {
std::string home_path_shell = std::getenv("HOME");
potential_config_dirs.push_back(home_path_shell + "/.config/weather-forecast");
} catch (const std::exception&) {}
} else {
potential_config_dirs.emplace_back("~/.config/weather-forecast");
potential_config_dirs.emplace_back("/etc/weather-forecast");
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ std::vector<std::string> Split(const std::string& str) {
return {std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>()};
}

std::string GetCurrentTime() {
std::string GetStringCurrentTime() {
std::ostringstream oss;
ConditionalOutput target{oss, true};
WriteCurrentTime(target);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ T MostCommon(InputIt begin, InputIt end) {

/**\n This function returns the current time. */

std::string GetCurrentTime();
std::string GetStringCurrentTime();

/**\n This function writes the current time to conditional stream. */

Expand Down

0 comments on commit 66b6ec3

Please sign in to comment.