mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-20 17:17:13 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
62
vendor/POCO/Foundation/samples/dir/src/dir.cpp
vendored
Normal file
62
vendor/POCO/Foundation/samples/dir/src/dir.cpp
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// dir.cpp
|
||||
//
|
||||
// This sample demonstrates the DirectoryIterator, File and Path classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/DirectoryIterator.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/DateTimeFormatter.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::DirectoryIterator;
|
||||
using Poco::File;
|
||||
using Poco::Path;
|
||||
using Poco::DateTimeFormatter;
|
||||
using Poco::DateTimeFormat;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string dir;
|
||||
if (argc > 1)
|
||||
dir = argv[1];
|
||||
else
|
||||
dir = Path::current();
|
||||
|
||||
try
|
||||
{
|
||||
DirectoryIterator it(dir);
|
||||
DirectoryIterator end;
|
||||
while (it != end)
|
||||
{
|
||||
Path p(it->path());
|
||||
std::cout << (it->isDirectory() ? 'd' : '-')
|
||||
<< (it->canRead() ? 'r' : '-')
|
||||
<< (it->canWrite() ? 'w' : '-')
|
||||
<< ' '
|
||||
<< DateTimeFormatter::format(it->getLastModified(), DateTimeFormat::SORTABLE_FORMAT)
|
||||
<< ' '
|
||||
<< p.getFileName()
|
||||
<< std::endl;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << exc.displayText() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user