/tocase

Convert case of unicode paths recursivly to lower/upper/title/foldcase

Primary LanguageC++GNU General Public License v3.0GPL-3.0

tocase

single-file header-only recursive unicode path case convert using icu

Downloading

git clone --recurse-submodules --recursive http://github.com/jopadan/tocase

Dependencies

Building

cmake . --install-prefix=[prefix] && make install

Example

mkdir -p FoE/DsAseE/dfRe.dESDf && touch FoE/DsAseE/dfRe.dESDf/fEe.ReE
tocase -c lower FoE/DsAseE/dfRe.dESDf
tocase -r -c lower FoE && rm -rf foe

Usage

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include "tocase.h"

using namespace std;
using namespace std::filesystem;

path src = argv[1];
case_mode mode = case_mode_from_str["lower"];
traverse_mode traverse = traverse_mode::recursive;

/* rename path and all of its contents recursively */
src = tocase(src, mode, traverse_moode::recursive);
cout << src << std::endl;

/* rename only path and none of its contents */
src = tocase(src, mode, traverse_mode::none);
cout << src << std::endl;
g++ -std=gnu++23 -I<location of directory including tocase.h> <file.cpp> -licuuc

Credits

Jon Daniel jondaniel879@gmail.com