Skip to content

Commit

Permalink
fix the issue of unwanted newlines in version/channel files, ugh
Browse files Browse the repository at this point in the history
  • Loading branch information
p0358 committed Mar 9, 2024
1 parent 5b46a56 commit 76a6f77
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
fetch-depth: 0

- name: Create channel file
run: echo ${{ env.BME_CHANNEL }} > ./installer/source/bme/bme_channel.txt
run: echo "${{ env.BME_CHANNEL }}" | Out-File -Encoding ascii ./installer/source/bme/bme_channel.txt -NoNewline
- name: Override version file (release only)
if: github.event_name == 'workflow_dispatch'
run: echo ${{ inputs.version }} > ./bme_version.txt
run: echo "${{ inputs.version }}" | Out-File -Encoding ascii ./bme_version.txt -NoNewline

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
Expand Down
14 changes: 0 additions & 14 deletions bmedll/FileSystemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ FileSystemManager::FileSystemManager(const std::string& basePath)
m_compiledPath = m_basePath / "r1_modsrc";
m_dumpPath = m_basePath / "assets_dump";
m_modsPath = m_basePath / "mods";
m_savesPath = m_basePath / "saves";
m_spawnlistsPath = m_basePath / "spawnlists";
if (!fs::exists(m_bspPath))
m_logger->error("bsp file does not exist at: {}", m_bspPath.string().c_str());

Expand Down Expand Up @@ -170,8 +168,6 @@ void FileSystemManager::EnsurePathsCreated()
fs::create_directories(m_dumpPath);
fs::create_directories(m_compiledPath);
fs::create_directories(m_modsPath);
fs::create_directories(m_savesPath);
fs::create_directories(m_spawnlistsPath);
}

// TODO: Do we maybe need to add the search path in a frame hook or will this do?
Expand Down Expand Up @@ -540,13 +536,3 @@ const fs::path& FileSystemManager::GetCompilePath()
{
return m_compiledPath;
}

const fs::path& FileSystemManager::GetSavesPath()
{
return m_savesPath;
}

const fs::path& FileSystemManager::GetSpawnlistsPath()
{
return m_spawnlistsPath;
}
4 changes: 0 additions & 4 deletions bmedll/FileSystemManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class FileSystemManager
fs::path m_compiledPath;
fs::path m_dumpPath;
fs::path m_modsPath;
fs::path m_savesPath;
fs::path m_spawnlistsPath;
std::vector<std::string> m_mapVPKs;
std::vector<std::string> m_mapNames;
std::string m_lastMapReadFrom;
Expand Down Expand Up @@ -51,6 +49,4 @@ class FileSystemManager
const fs::path& GetBasePath();
const fs::path& GetModsPath();
const fs::path& GetCompilePath();
const fs::path& GetSavesPath();
const fs::path& GetSpawnlistsPath();
};
7 changes: 7 additions & 0 deletions bmedll/TTFSDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ const std::string GetBMEChannel()
chan = sstr.str();
}
else chan = std::string(BME_CHANNEL);
const auto rtrim = [](std::string_view str) -> std::string_view
{
const auto pos(str.find_last_not_of(" \t\n\r\f\v"));
str.remove_suffix(std::min(str.length() - pos - 1, str.length()));
return str;
};
chan = rtrim(chan);
return chan;
}

Expand Down

0 comments on commit 76a6f77

Please sign in to comment.