예제 #1
0
short bMainThread :: Start()
{
	Editor	ed; 
	int		lp;

	if (argc > 1)
	{
		File	*f;

		for (lp=1 ; lp < argc ; lp++)
		{
			f = new File(argv[lp]);
			if (!f->Exists())
			{
				char buf[300];
				sprintf(buf, "File %s does not exist", argv[lp]);
				wMessageBox mb(&ed, buf, "Error", MbIconExclamation | MbOk);
			}
			else
				new Document(&ed, argv[lp]);
			delete f;
		}
		ed.TileDocuments();
	}

	Exec();

	return 0;
}
예제 #2
0
void Settings::Load()
{
    Directory appDataDir = GetAppDataDir();
    if (appDataDir.Exists())
    {
        File config;
        config.SetLocation(appDataDir.Location().OriginalString() + "/config.txt");
        FileStream fs;
        if (config.Exists())
        {
            AutoPointerArray<UInt8> buf(new UInt8[config.Size()], config.Size());
            if (fs.Open(config.Location(), FileAccessMode::Read, FileAccessPriority::ReadThroughput))
            {
                fs.Read(buf.Get(), 0, buf.Size());
                fs.Close();
                for (Size i = 0, s = 0; i < buf.Size(); ++i)
                    if (buf[i] == '\n')
                    {
                        String line = String(reinterpret_cast<const char*>(&buf[s]), i - s);
                        AutoPointerArray<String> keyValue = line.Split(String("="));
                        if (keyValue.Count() == 2)
                        {
                            const char* key = StringCache::Find(keyValue[0]);
                            if (key == 0)
                                key = keyValue[0].c_str();
                            m_PImpl->m_Data[key] = keyValue[1];
                        }
                        s = i+1;
                    }
            }
        }
    }
}
예제 #3
0
	extern "C" uint64_t Syscall_CheckFileExistence(const char* path)
	{
		using namespace Kernel::HardwareAbstraction::Filesystems::VFS;
		File* f = new File(path);
		bool ret = f->Exists();
		delete f;

		return ret;
	}
예제 #4
0
    File MediaManager::FindMedia(const File& filename) const
    {
        for (std::set<std::string>::const_iterator itr = m_Paths.begin(); itr != m_Paths.end(); ++itr)
        {
            File retFile = *itr + filename.Fullname();
            if (retFile.Exists())
                return retFile;
        }

        throw LoadingFailed(filename.Fullname(), "Fichier introuvable dans les répertoires de recherche");
    }
예제 #5
0
파일: dirs.cpp 프로젝트: TRI0N/wwiv
bool checkDirExists(File &dir, const char *desc) {
  if (dir.Exists()) {
    return true;
  }

  LOG(INFO) << "For File Area: " << desc;
  LOG(INFO) << "Unable to find dir: " << dir.full_pathname();
  LOG(INFO) << "Please create it.";
  return false;
  //printf("   Do you wish to CREATE it (y/N)?\n");
  //string s;
  //std::cin >> s;
  //if (s[0] == 'Y' || s[0] == 'y') {
  //  if (!File::mkdirs(dir)) {
  //    Print(NOK, true, "Unable to create dir '%s' for %s dir.", dir.full_pathname().c_str(), desc);
  //    return false;
  //  }
  //}
  //return true;
}
예제 #6
0
#include "..\Catch.hpp"

#include <File.hpp>

using SmartIO::File;

TEST_CASE("File - Testing the Exists functionality.")
{
	File file("TestDirectory/SomeFile.txt");

	REQUIRE(file.Exists());
}

TEST_CASE("File - Testing the Create functionality.")
{
	File file("TestDirectory/SubDirectory/NewFile.txt");

	REQUIRE(file.Create(true));
}

TEST_CASE("File - Testing the Writing functionality.")
{
	File file("TestDirectory/SomeFile.txt");

	REQUIRE(file.Write("Something"));
}

TEST_CASE("File - Testing the Encryption functionality.")
{
	File file("TestDirectory/SomeFile.txt");