bool FileTreeFactory::CreateFile(const std::wstring strName, const FileType eFileType, FileNode &newFile) { newFile.SetValue(FileAttributeType_eFileType, eFileType); newFile.SetValue(FileAttributeType_strName, strName); newFile.SetValue(FileAttributeType_strPath, MAIN_FOLDER); return true; }
bool FileTreeFactory::CreateFile(const FileNode &parentFile, const std::wstring strName, const FileType eFileType, FileNode &childFile) { if (CreateFile(strName, eFileType, childFile)) { std::wstring strPath; std::wstring strFolderName; parentFile.GetValue(FileAttributeType_strName, strFolderName); parentFile.GetValue(FileAttributeType_strPath, strPath); std::wstring strNewFilePath = strPath + L"\\" + strFolderName; childFile.SetValue(FileAttributeType_strPath, strNewFilePath); std::wstring strFileName; childFile.GetValue(FileAttributeType_strName, strFileName); std::wstring strNewFileName = strNewFilePath + L"\\" + strFileName; if (eFileType == FOLDER_TYPE) return OnCreateFolder(strNewFileName); else return OnCreateFile(strNewFileName); } return false; }