Skip to content

Commit

Permalink
FileInfo is now an immutable struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yatima1460 committed Jul 19, 2019
1 parent 3884625 commit 014c12f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 67 deletions.
23 changes: 12 additions & 11 deletions Source/Backend/Crawler.d
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,18 @@ private:

immutable(FileInfo) buildFileInfo(DirEntry currentFile) const
{
FileInfo f;
f.isDirectory = !currentFile.isDir();
f.isDirectory = currentFile.isDir();
f.fullPath = currentFile.name;
f.fileName = baseName(currentFile.name);
f.fileNameLower = toLower(f.fileName);
f.containingFolder = dirName(currentFile.name);
f.extension = extension(currentFile.name);
f.sizeString = humanSize(currentFile.size);
f.originalMountpoint = this.MOUNTPOINT;
f.dateModifiedString = toDateString(currentFile.timeLastModified());
FileInfo f = {
this.MOUNTPOINT,
currentFile.isDir(),
!currentFile.isDir(),
toDateString(currentFile.timeLastModified()),
dirName(currentFile.name),
baseName(currentFile.name),
toLower(baseName(currentFile.name)),
extension(currentFile.name),
currentFile.name,
humanSize(currentFile.size)
};
return f;
}

Expand Down
65 changes: 9 additions & 56 deletions Source/Backend/FileInfo.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ module FileInfo;
/**
FileInfo is a struct filled by the information a crawler can find about a file
*/
struct FileInfo
immutable struct FileInfo
{

/**
The original mountpoint used by a crawler that found this file
*/
Expand All @@ -24,7 +23,7 @@ struct FileInfo
/**
true if is a symbolic link
*/
bool isSymbolic;
//bool isSymbolic;

/**
string of the date modified
Expand All @@ -39,14 +38,13 @@ struct FileInfo
/**
name of the icon to use on the left of the name
*/
string iconName;
//string iconName;

/**
the filename with extension
*/
string fileName;


/**
the filename with extension but lower string
*/
Expand All @@ -57,58 +55,13 @@ struct FileInfo
*/
string extension;



/**
Complete full path of the file
*/
string fullPath;



/**
The size of the file, already converted as a human readable string
*/
string sizeString;





}

// this(DirEntry de)
// {

// }

// void isDirectory()
// {

// }

// string getDateModifiedString()
// {

// }

// void openContainingFolder()
// {

// }

// void openFile()
// {

// }

// string getContainingFolder()
// {

// }

// string getFileName()
// {

// }

// string getIconName()
// {

// }

// }

0 comments on commit 014c12f

Please sign in to comment.