Files
OpenVulkano/openVulkanoCpp/Host/Linux/ExeAppendedZipResourceLoaderLinux.cpp
2024-12-21 17:43:17 +02:00

27 lines
740 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include "ExeAppendedZipResourceLoaderLinux.hpp"
#include <unistd.h>
#include <climits>
namespace OpenVulkano
{
namespace
{
void* HANDLE = ResourceLoader::RegisterResourceLoader(std::make_unique<ExeAppendedZipResourceLoaderLinux>());
}
std::string OpenVulkano::ExeAppendedZipResourceLoaderLinux::GetCurrentExecutablePath() const
{
std::string path(PATH_MAX, '\0');
ssize_t sz = readlink("/proc/self/exe", path.data(), path.capacity());
path.resize(std::max<ssize_t>(0, sz));
return path;
}
}