#include #include #include #include using std::cout; using std::cin; using std::endl; using std::string; namespace fs = std::filesystem; int main() { fs::path cPath, basePath; cPath = fs::current_path(); cout << cPath.string() << endl; basePath = cPath; string subDir("Assets"); fs::path subPath(cPath.string() + "\\" + subDir); assert(fs::exists(subPath)); //フォルダがあるときしか、ここに到達しない cout << subPath.string() << "は、ありま~す(晴子風)" << endl; fs::current_path(subPath); cPath = fs::current_path(); cout << cPath.string() << endl; fs::path imageFile("Oden.jpg"); if (fs::is_regular_file(imageFile)) { cout << imageFile.string() << "は、ありま~す(晴子風)" << endl; } fs::current_path(basePath); cPath = fs::current_path(); cout << cPath.string() << endl; //fs::is_regular_file() //初めのカレントフォルダを覚えておく->カレント表示 //Assetsにカレントを移動->カレント表示 //AssetsにOden.jpgがあるか確認->結果表示 //カレントを元のものに戻す->カレント表示 }