Commit 059e0989 authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

linux

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58263 954022d7-b5bf-4e40-9824-e11837661b57
parent 864d5c54
......@@ -51,7 +51,7 @@ SOURCES += docxformatlib.cpp \
../Source/DocxFormat/Docx.cpp \
../Source/DocxFormat/FileFactory.cpp \
../Source/DocxFormat/IFileContainer.cpp \
../Source/SystemUtility/FileSystem/Directory.cpp \
../Source/SystemUtility/FileSystem/DirectoryPosix.cpp \
../Source/SystemUtility/FileSystem/File.cpp \
../Source/SystemUtility/Solution/FileSystemTest/AssemblyInfo.cpp \
../Source/SystemUtility/Solution/FileSystemTest/DirectoryTest.cpp \
......
......@@ -12,21 +12,21 @@
#include "FontTable.h"
#include "Styles.h"
#include "Bibliography.h"
#include "FootNote.h"
#include "EndNote.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "Media\Audio.h"
#include "Media\Video.h"
#include "External\HyperLink.h"
#include "External\ExternalVideo.h"
#include "External\ExternalAudio.h"
#include "External\ExternalImage.h"
#include "Footnote.h"
#include "Endnote.h"
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "Media/Audio.h"
#include "Media/Video.h"
#include "External/HyperLink.h"
#include "External/ExternalVideo.h"
#include "External/ExternalAudio.h"
#include "External/ExternalImage.h"
#include "HeaderFooter.h"
#include "Numbering.h"
#include "Comments.h"
#include "UnknowTypeFile.h"
#include "Diagram\DiagramDrawing.h"
#include "Diagram/DiagramDrawing.h"
namespace OOX
......@@ -163,4 +163,4 @@ namespace OOX
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
} // namespace OOX
\ No newline at end of file
} // namespace OOX
......@@ -4,10 +4,10 @@
#include "ContentTypes.h"
#include "FileType.h"
#include "External\External.h"
#include "External\HyperLink.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "External/External.h"
#include "External/HyperLink.h"
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "FileTypes.h"
#include "../XlsxFormat/FileFactory_Spreadsheet.h"
......@@ -341,4 +341,4 @@ namespace OOX
} // namespace OOX
\ No newline at end of file
} // namespace OOX
#pragma once
#include "Settings.h"
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
......@@ -10,6 +12,10 @@
#include <tchar.h>
#include <strsafe.h>
#else
#include "../../Base/ASCString.h"
#endif
namespace FileSystem {
class Directory {
......
#include "Directory.h"
#include "../../Base/ASCString.h"
//#include <shlobj.h>
namespace FileSystem {
LPCTSTR Directory::GetCurrentDirectory() {
static const int bufferSize = MAX_PATH;
LPTSTR directory = new TCHAR[bufferSize];
DWORD lenght = ::GetCurrentDirectory(bufferSize, directory);
if (lenght == 0) {
delete[] directory;
directory = NULL;
}
return directory;
}
String Directory::GetCurrentDirectoryS() {
LPCTSTR directory = GetCurrentDirectory();
if (directory == NULL)
return String();
return String(directory);
}
bool Directory::CreateDirectory(LPCTSTR path) {
bool directoryCreated = false;
if (::CreateDirectory(path, NULL) == TRUE)
directoryCreated = true;
return directoryCreated;
}
bool Directory::CreateDirectory(const String& path) {
return CreateDirectory(path.c_str());
}
bool Directory::CreateDirectories(LPCTSTR path)
{
int codeResult = ERROR_SUCCESS;
codeResult = SHCreateDirectory(NULL, path);
bool created = false;
if (codeResult == ERROR_SUCCESS)
created = true;
return created;
}
StringArray Directory::GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories) {
size_t pathLength = 0;
StringCchLength(path, MAX_PATH, &pathLength);
++pathLength;
size_t pathToFilesLength = pathLength + 3;
LPTSTR pathToFiles = new TCHAR[pathToFilesLength];
StringCchCopy(pathToFiles, pathLength, path);
StringCchCat(pathToFiles, pathToFilesLength, TEXT("\\*"));
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathToFiles, &findData);
delete[] pathToFiles;
if (findResult == INVALID_HANDLE_VALUE)
return StringArray();
StringArray files;
do {
if (andSubdirectories || !(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
String file = findData.cFileName;
files.insert(files.end(), file);
}
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return files;
}
StringArray Directory::GetFilesInDirectory(const String& path, const bool& andSubdirectories) {
LPCTSTR pathW = path.c_str();
return GetFilesInDirectory(pathW, andSubdirectories);
}
int Directory::GetFilesCount(const CString& path, const bool& recursive) {
CString pathMask = path + _T("\\*");
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathMask, &findData);
int filesCount = 0;
do {
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
if (!recursive)
continue;
if ((CString) findData.cFileName == _T("."))
continue;
if ((CString) findData.cFileName == _T(".."))
continue;
CString innerPath = path + _T('\\') + (CString) findData.cFileName;
filesCount += GetFilesCount(innerPath, recursive);
}
else
++filesCount;
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return filesCount;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment