मैं बढ़ावा फाइल सिस्टम के साथ वर्तमान निर्देशिका के लिए पथ हो रही है, तो पता चल सके कि निर्देशिका मौजूद है।बढ़ावा :: फाइल सिस्टम() निर्देशिका पथ पर विफल रहता है मौजूद है, लेकिन is_directory() ठीक
is_directory()
ठीक है, लेकिन exists()
उसी रास्ते पर विफल रहता है, क्या मुझे कुछ याद आ रही है?
उदाहरण कोड (1.35 को बढ़ावा देने):
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
// the path is full path /home/my/somedirectory
fs::path data_dir(fs::current_path());
fs::is_directory(data_dir) // true, directory exists
fs::exists(data_dir) // false
exists(status(data_dir)) // false
संपादित करें:
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
fs::path data_dir(fs::current_path());
// data_dir == "/home/myusername/proj/test"
if (fs::is_directory(data_dir)) // true - is directory
if (fs::is_directory(fs::status(data_dir))) // true - it is still a directory
मज़ा हिस्सा:
if (fs::exists(fs::status(data_dir))) // true - directory exists
if (fs::exists(data_dir)) // true - directory exists
लेकिन:
if (!fs::exists(fs::status(data_dir))) // false - directory still exists
if (!fs::exists(data_dir)) // true - directory does not exists
आप Windows का उपयोग कर रहे हैं? यह अंतर्निहित विंडोज एपीआई की एक ज्ञात सीमा है। –
विंडोज़ पर मेरे लिए काम करता है। – interjay