Created
January 4, 2022 16:48
-
-
Save Bajron/9d73b508d39ad1142694e2b2fe278d1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <filesystem> | |
int main() | |
{ | |
const auto sandbox = std::filesystem::absolute(std::filesystem::path{ "sandbox" }); | |
if (std::filesystem::exists(sandbox)) | |
{ | |
std::clog << "Removing " << sandbox << " because it exists" << std::endl; | |
std::filesystem::remove_all(sandbox); | |
} | |
std::filesystem::create_directories(sandbox); | |
std::clog << "Sandbox lenght: " << sandbox.string().size() << std::endl; | |
// Other constants from here are not handled, it should prove the point, if you have a lot till the limit | |
const auto toTheLimit = 260 - sandbox.string().size(); | |
const auto problematic = toTheLimit * 2 / 3; | |
const auto longName = std::string(problematic, 'b'); | |
const auto levelX = sandbox / "dPCRRelease-windows_amd64-v11.1.0.68-51da8cf-mimic" ; | |
const auto branchA = sandbox / "a" / longName; | |
const auto branchB = sandbox / "pa" / ("p" + longName); | |
std::filesystem::create_directories(branchA); | |
std::filesystem::create_directories(branchB); | |
std::filesystem::current_path(branchA); | |
std::clog << "Changed dir" << std::endl; | |
{ | |
std::ofstream ofs{ branchB / "t" }; | |
ofs << "welp" << std::endl; | |
} | |
const std::string input = "../../pa/p" + longName; | |
const auto inputRelative = input; | |
const auto inputAbsolute = std::filesystem::absolute(inputRelative); | |
const auto inputProcessed = std::filesystem::relative(inputAbsolute); | |
std::clog << "inputRelative: " << std::filesystem::exists(inputRelative) << " -- " << inputRelative << std::endl; | |
std::clog << "inputAbsolute: " << std::filesystem::exists(inputAbsolute) << " -- " << inputAbsolute << std::endl; | |
std::clog << "inputProcessed: " << std::filesystem::exists(inputProcessed) << " -- " << inputProcessed << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment