diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index eb037fb7d..45d0adca0 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4906,22 +4906,8 @@ int CClient::UdpConnectivity(int NetType) #if defined(CONF_FAMILY_WINDOWS) void CClient::ShellRegister() { - char aBinaryPath[IO_MAX_PATH_LENGTH]; - Storage()->GetBinaryPath(PLAT_CLIENT_EXEC, aBinaryPath, sizeof(aBinaryPath)); char aFullPath[IO_MAX_PATH_LENGTH]; - if(fs_is_relative_path(aBinaryPath)) - { - if(fs_getcwd(aFullPath, sizeof(aFullPath))) - { - str_append(aFullPath, "/", sizeof(aFullPath)); - str_append(aFullPath, aBinaryPath, sizeof(aFullPath)); - } - else - aFullPath[0] = '\0'; - } - else - str_copy(aFullPath, aBinaryPath); - + Storage()->GetBinaryPathAbsolute(PLAT_CLIENT_EXEC, aFullPath, sizeof(aFullPath)); if(!aFullPath[0]) { dbg_msg("client", "Failed to register protocol and file extensions: could not determine absolute path"); diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp index 2a5e8a677..b64c4dded 100644 --- a/src/engine/shared/storage.cpp +++ b/src/engine/shared/storage.cpp @@ -677,6 +677,25 @@ public: return pBuffer; } + const char *GetBinaryPathAbsolute(const char *pFilename, char *pBuffer, unsigned BufferSize) override + { + char aBinaryPath[IO_MAX_PATH_LENGTH]; + GetBinaryPath(PLAT_CLIENT_EXEC, aBinaryPath, sizeof(aBinaryPath)); + if(fs_is_relative_path(aBinaryPath)) + { + if(fs_getcwd(pBuffer, BufferSize)) + { + str_append(pBuffer, "/", BufferSize); + str_append(pBuffer, aBinaryPath, BufferSize); + } + else + pBuffer[0] = '\0'; + } + else + str_copy(pBuffer, aBinaryPath, BufferSize); + return pBuffer; + } + static IStorage *Create(int StorageType, int NumArgs, const char **ppArguments) { CStorage *pStorage = new CStorage(); diff --git a/src/engine/storage.h b/src/engine/storage.h index e52e7b595..e3f69841f 100644 --- a/src/engine/storage.h +++ b/src/engine/storage.h @@ -57,6 +57,7 @@ public: virtual bool RemoveBinaryFile(const char *pFilename) = 0; virtual bool RenameBinaryFile(const char *pOldFilename, const char *pNewFilename) = 0; virtual const char *GetBinaryPath(const char *pFilename, char *pBuffer, unsigned BufferSize) = 0; + virtual const char *GetBinaryPathAbsolute(const char *pFilename, char *pBuffer, unsigned BufferSize) = 0; static void StripPathAndExtension(const char *pFilename, char *pBuffer, int BufferSize); static const char *FormatTmpPath(char *aBuf, unsigned BufSize, const char *pPath);