File tree Expand file tree Collapse file tree 6 files changed +77
-6
lines changed
Expand file tree Collapse file tree 6 files changed +77
-6
lines changed Original file line number Diff line number Diff line change 1919 </ProjectConfiguration >
2020 </ItemGroup >
2121 <ItemGroup >
22+ <ClCompile Include =" Source\Configuration.cpp" />
2223 <ClCompile Include =" Source\LaunchBounce.cpp" />
2324 <ClCompile Include =" Source\Logger.cpp" />
2425 </ItemGroup >
2526 <ItemGroup >
27+ <ClInclude Include =" Source\Configuration.h" />
2628 <ClInclude Include =" Source\Logger.h" />
2729 </ItemGroup >
2830 <PropertyGroup Label =" Globals" >
Original file line number Diff line number Diff line change 2121 <ClCompile Include =" Source\Logger.cpp" >
2222 <Filter >Source Files</Filter >
2323 </ClCompile >
24+ <ClCompile Include =" Source\Configuration.cpp" >
25+ <Filter >Source Files</Filter >
26+ </ClCompile >
2427 </ItemGroup >
2528 <ItemGroup >
2629 <ClInclude Include =" Source\Logger.h" >
2730 <Filter >Header Files</Filter >
2831 </ClInclude >
32+ <ClInclude Include =" Source\Configuration.h" >
33+ <Filter >Header Files</Filter >
34+ </ClInclude >
2935 </ItemGroup >
3036</Project >
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright 2024 David Roller
3+ //
4+ // Licensed under the Apache License, Version 2.0 (the "License");
5+ // you may not use this file except in compliance with the License.
6+ // You may obtain a copy of the License at
7+ //
8+ // http://www.apache.org/licenses/LICENSE-2.0
9+ //
10+ // Unless required by applicable law or agreed to in writing, software
11+ // distributed under the License is distributed on an "AS IS" BASIS,
12+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ // See the License for the specific language governing permissions and
14+ // limitations under the License.
15+ //
16+ #include " Configuration.h"
17+ #include < Windows.h>
18+
19+ using Therena::LaunchBounce::Configuration;
20+
21+ void Configuration::Initialize (int argc, wchar_t * argv[])
22+ {
23+
24+ }
25+
26+ std::filesystem::path Configuration::GetAppPath ()
27+ {
28+ wchar_t pathBuffer[MAX_PATH + 1 ];
29+ ::GetModuleFileNameW (nullptr , pathBuffer, MAX_PATH);
30+ return pathBuffer;
31+ }
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright 2024 David Roller
3+ //
4+ // Licensed under the Apache License, Version 2.0 (the "License");
5+ // you may not use this file except in compliance with the License.
6+ // You may obtain a copy of the License at
7+ //
8+ // http://www.apache.org/licenses/LICENSE-2.0
9+ //
10+ // Unless required by applicable law or agreed to in writing, software
11+ // distributed under the License is distributed on an "AS IS" BASIS,
12+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ // See the License for the specific language governing permissions and
14+ // limitations under the License.
15+ //
16+ #pragma once
17+
18+ #include < filesystem>
19+
20+ namespace Therena ::LaunchBounce
21+ {
22+ class Configuration final
23+ {
24+ public:
25+ Configuration () = delete ;
26+
27+ static void Initialize (int argc, wchar_t * argv[]);
28+
29+ static std::filesystem::path GetAppPath ();
30+ };
31+ }
Original file line number Diff line number Diff line change 1414// limitations under the License.
1515//
1616#include " Logger.h"
17+ #include " Configuration.h"
1718
1819using Therena::LaunchBounce::Logger;
20+ using Therena::LaunchBounce::Configuration;
1921
2022int wmain (int argc, wchar_t * argv[])
2123{
24+ Configuration::Initialize (argc, argv);
25+
2226 Logger::Info (L" ##################################################################################" );
2327 Logger::Info (L" Execute launch bounce" );
2428 Logger::Info (L" ##################################################################################" );
Original file line number Diff line number Diff line change 2020#include < iostream>
2121#include < filesystem>
2222#include < fstream>
23+ #include " Configuration.h"
2324
2425using Therena::LaunchBounce::Logger;
26+ using Therena::LaunchBounce::Configuration;
2527
2628void Logger::Info (const std::wstring& message)
2729{
@@ -46,12 +48,7 @@ void Logger::WriteLog(const std::wstring& message)
4648{
4749 std::wcout << message << std::endl;
4850
49- wchar_t pathBuffer[MAX_PATH + 1 ];
50- ::GetModuleFileNameW (nullptr , pathBuffer, MAX_PATH);
51-
52- std::filesystem::path path = pathBuffer;
53- const auto logFilePath = path.replace_extension (L" .log" );
54-
51+ const auto logFilePath = Configuration::GetAppPath ().replace_extension (L" .log" );
5552
5653 std::wofstream fileStream (logFilePath, std::ios_base::app);
5754
You can’t perform that action at this time.
0 commit comments