mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
69
sdk/tools/hhpcomp/utils.cpp
Normal file
69
sdk/tools/hhpcomp/utils.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
|
||||
// This file is part of hhpcomp, a free HTML Help Project (*.hhp) compiler.
|
||||
// Copyright (C) 2015 Benedikt Freisen
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h> // for GetFullPathNameA
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
string to_upper(string s)
|
||||
{
|
||||
string temp = s;
|
||||
transform(temp.begin(), temp.end(), temp.begin(), ::toupper);
|
||||
return temp;
|
||||
}
|
||||
|
||||
string real_path(const char* path)
|
||||
{
|
||||
char* temp = NULL;
|
||||
#if defined(_WIN32)
|
||||
char temp2[MAX_PATH];
|
||||
if (GetFullPathNameA(path, MAX_PATH, temp2, NULL)) {
|
||||
temp = temp2;
|
||||
}
|
||||
#else
|
||||
temp = realpath(path, NULL);
|
||||
#endif
|
||||
if (temp == NULL)
|
||||
throw runtime_error("realpath failed");
|
||||
string result(temp);
|
||||
#if !defined(_WIN32)
|
||||
free(temp);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
string replace_backslashes(string s)
|
||||
{
|
||||
string temp = s;
|
||||
for (string::iterator it = temp.begin(); it != temp.end(); ++it)
|
||||
if (*it == '\\')
|
||||
*it = '/';
|
||||
return temp;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue