class FileSystemBoxBits
{
- bool foldersOnly:1, filesOnly:1, details:1, treeBranches:1, previewPictures:1, navigateFolders:1;
+ bool foldersOnly:1, filesOnly:1, details:1, pathColumn:1, treeBranches:1, previewPictures:1, navigateFolders:1, autoLoad:1;
+ bool preview:1;
//bool header:1, freeSelect:1, fullRowSelect:1, multiSelect:1, autoScroll:1, alwaysHL : 1, moveRows:1, resizable:1;
//bool moveFields:1, clearHeader:1, alwaysEdit:1, collapse:1, treeBranch:1, rootCollapse:1, heightSet:1;
//bool sortable:1, noDragging:1, fillLastField:1, expandOnAdd:1;
};
public class FileSystemBox : Window // should we not derive from ListBox instead?
+ // I say we should, but we can't right now...
+ // because ListBox (inside ecere library) is
+ // not exposing enough internal machinery...
+ // could we not have a different private and
+ // public mechanism when deriving a class than
+ // we do when simply instanciating a class?
/*
this stuff from the listbox would be nicely exposed...
fullRowSelect = false;
public:
FileSystemNode root;
- FileSystemNode selection;
+ FileSystemBoxSelection selection { };
- virtual bool Window::NotifyNodeSelect(FileSystemBox box, FileSystemNode node);
- virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemNode node);
+ virtual bool Window::NotifyNodeSelect(FileSystemBox box, FileSystemBoxSelection selection);
+ //virtual bool Window::NotifyNodeNavigate(FileSystemBox box, FileSystemNode node);
+ virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection);
property char * path
{
property bool filesOnly { set { bits.filesOnly = value; bits.foldersOnly = !value; } get { return bits.filesOnly; } };
property bool previewPictures { set { bits.previewPictures = value; } get { return bits.previewPictures; } };
property char * extensions { set { delete extensions; if(value && value[0]) extensions = CopyString(value); } get { return extensions; } }
- property bool details { set { bits.details = value; } get { return bits.details; } };
+ property bool details { set { bits.details = value; ChangeViewType(); } get { return bits.details; } };
+ property bool pathColumn { set { bits.pathColumn = value; ChangeViewType(); } get { return bits.pathColumn; } };
property bool treeBranches
{
set
}
get { return bits.treeBranches; }
};
+ property Color selectionColor { set { list.selectionColor = value; } get { return list.selectionColor; }/* isset { return selectionColor ? true : false; }*/ };
+ property Color selectionText { set { list.selectionText = value; } get { return list.selectionText; }/* isset { return selectionText ? true : false; }*/ };
property bool navigateFolders { set { bits.navigateFolders = value; bits.filesOnly = !value; } get { return bits.navigateFolders; } };
property bool multiSelect { set { list.multiSelect = value; } get { return list.multiSelect; } };
+ property bool autoLoad { set { bits.autoLoad = value; } get { return bits.autoLoad; } };
+ property bool hasHeader { set { list.hasHeader = value; } get { return list.hasHeader; } };
+ property bool preview
+ {
+ set
+ {
+ bits.preview = value;
+ split.leftPane = value ? list : null;
+ split.visible = value;
+ show.visible = value;
+ }
+ get { return bits.preview; }
+ };
property FileSystemNode node
{
}
}
+ void SelectMultipleByPath(Array<String> paths)
+ {
+ DataRow row;
+ bool firstRow = false;
+ Map<String, bool> map { };
+ for(path : paths)
+ map[path] = true;
+ for(row = list.firstRow; row; row = row.next)
+ {
+ FileSystemNode node = (FileSystemNode)row.tag;
+ if(map[node.path])
+ {
+ if(!firstRow)
+ {
+ list.SelectRow(row);
+ firstRow = true;
+ }
+ else
+ row.selected = true;
+ }
+ else
+ row.selected = false;
+ }
+ delete map;
+ }
+
+ FileSystemNode SelectLocation(char * location)
+ {
+ int c;
+ char * temp;
+ char step[MAX_LOCATION];
+
+ //StringArray steps { growingFactor = 4 };
+ Array<String> steps { };
+ FileSystemNode result = null;
+ FileSystemNode node = null;
+
+ temp = CopyString(location);
+ while(temp[0])
+ {
+ GetLastDirectory(temp, step);
+ StripLastDirectory(temp, temp);
+ steps.Add(CopyString(step));
+ }
+
+ for(c = steps.count - 1; c >= 0; c--)
+ {
+ char * t = steps[c];
+ node = Find(steps[c], node);
+ if(!node)
+ break;
+ //Select(node);
+ }
+ if(node)
+ {
+ result = node;
+ Select(result);
+ }
+
+ steps.Free();
+ delete temp;
+ delete steps;
+
+ return result;
+ }
+
FileSystemNode Find(const char * name, FileSystemNode parent)
{
- FileSystemNode node;
- FileSystemNode start = parent ? parent : root;
- if(!start.loaded || !start.childrenLoaded)
- LoadTreeNode(start);
- for(node = start.children.first; node; node = node.next)
- if(node.name && !strcmpi(node.name, name))
- return node;
- return null;
+ FileSystemNode node = null;
+ FileSystemNode result = null;
+ if(!parent/* && !strcmp(name, "/")*/)
+ {
+ DataRow row;
+ for(row = list.firstRow; row; row = row.next)
+ {
+ node = (FileSystemNode)row.tag;
+ if(node.name && !fstrcmp(node.name, name))
+ break;
+ }
+ if(node)
+ result = node;
+ //result = root;
+ }
+ else
+ {
+ FileSystemNode start = parent ? parent : root;
+ if(!start.bits.loaded || !start.bits.childrenLoaded)
+ LoadTreeNode(start);
+ for(node = start.children.first; node; node = node.next)
+ if(node.name && !fstrcmp(node.name, name))
+ break;
+ if(node)
+ result = node;
+ }
+ return result;
+ }
+
+ void Clear()
+ {
+ list.Clear();
}
void Refresh()
BitmapResource fileIcons[_FileType];
+ Bitmap bitmap;
+ //BitmapArray bitmaps { growingFactor = 16 };
+
FileSystemBox()
{
char wd[MAX_LOCATION];
InitFileIcons();
list.AddField(nameField);
+ bits.autoLoad = true;
}
+
~FileSystemBox()
{
delete extensions;
delete path;
}
+
+ watch(background)
+ {
+ list.background = background;
+ };
+
void InitFileIcons()
{
_FileType c;
}
}
- DataField nameField { dataType = "FileSystemNode", width = 240, userData = this, freeData = false };
+ DataField nameField { header = "Name", dataType = "FileSystemNode", width = 240, userData = this, freeData = false };
+ DataField pathField { header = "Location", dataType = /*"String"*/ "char *", width = 300, freeData = false };
DataField typeField { header = "Type", dataType = /*"String"*/ "char *", width = 40, freeData = false };
DataField sizeField { header = "Size", dataType = "FileSize", width = 96, alignment = right, freeData = false };
+ DataField modifiedField { header = "Modified", dataType = "SecSince1970", width = 96, alignment = right, freeData = false };
bool OnPostCreate()
{
- Load();
+ if(bits.autoLoad)
+ Load();
return true;
}
hasVertScroll = true;
fullRowSelect = false;
sortable = true;
+ alwaysHighLight = true;
anchor = Anchor { left = 0, top = 0, right = 0, bottom = 0 };
}
else
{
- if(!node.loaded || !node.childrenLoaded)
+ if(!node.bits.loaded || !node.bits.childrenLoaded)
{
LoadTreeNode(node);
//list.Sort(nameField, 1);
FileSystemNode node = (FileSystemNode)row.tag;
if(node)
{
+ char * text;
+
PopupMenu popup;
Menu menu { };
+ text = PrintString("Open ", node.path);
+
+ MenuItem { menu, text, o, NotifySelect = MenuOpen, disabled = false };
MenuItem { menu, "Cut\tCtrl+X", t, NotifySelect = null, disabled = false };
MenuItem { menu, "Copy\tCtrl+C", c, NotifySelect = null, disabled = false };
MenuItem { menu, "Paste\tCtrl+V", p, NotifySelect = null, disabled = false /*!clipboard*/ };
bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
{
- if(row)
+ OldList rows;
+ OldLink item;
+
+ selection.nodes.Free();
+ list.GetMultiSelection(rows);
+ for(item = rows.first; item; item = item.next)
{
+ DataRow row = item.data;
FileSystemNode node = (FileSystemNode)row.tag;
- NotifyNodeSelect(listBox.parent.master, this, node);
- selection = node;
+ selection.nodes.Add(node);
+ incref node;
}
+ rows.Free(null);
+ if(row)
+ selection.node = (FileSystemNode)row.tag;
+ else
+ selection.node = null;
+
+ if(selection.node && bits.preview)
+ {
+ //int pos;
+ FileSystemNode node = selection.node;
+ /*if(bitmap)
+ bitmap.Free();*/
+ delete bitmap;
+ if(node && node.type == pictureFile)
+ {
+ bitmap = Bitmap { };
+ bitmap.Load(node.path, null, displaySystem);
+ }
+
+ /*bitmaps.Clear();
+ bitmaps = BitmapArray { };
+ for(pos = 0; pos < selectedItems.count; pos++)
+ {
+ Bitmap bitmap { };
+ selItem = (ExplorerFileItem)selectedItems._[pos];
+ bitmap.Load(selItem.path, null, displaySystem);
+ //bitmaps.Add(bitmap);
+ }
+ if(node && node.type == pictureFile)
+ {
+ bitmap = Bitmap { };
+ bitmap.Load(node.path, null, displaySystem);
+ }*/
+
+ show.Update(null);
+ //NotifyItemSelect(master, view, item, selectedItems);
+ }
+
+ NotifyNodeSelect(listBox.parent.master, this, selection);
return true;
}
bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
{
+ bool result = !(selection.node && selection.node.type.isFolder && bits.navigateFolders);
OpenNode();
- return false;
+ return result;
}
bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
}
};
- bool OpenNode()
+ PaneSplitter split
{
- bool result;
- if(selection && selection.type.isFolder && bits.navigateFolders)
+ this;
+ //leftPane = list;
+ rightPane = show;
+ //split = 200;
+ scaleSplit = 0.5f;
+ tabCycle = true;
+ visible = false;
+ };
+
+ Window show
+ {
+ this;
+ visible = false;
+ borderStyle = none;
+ anchor = Anchor { top = 0, right = 0, bottom = 0 };
+
+ void OnRedraw(Surface surface)
{
- property::path = selection.path;
- result = true;
+ FileSystemBox fsb = (FileSystemBox)parent;
+ if(fsb.bitmap)
+ {
+ int wBmp = fsb.bitmap.width;
+ int hBmp = fsb.bitmap.height;
+ int wWnd = fsb.show.clientSize.w;
+ int hWnd = fsb.show.clientSize.h;
+
+ int wList = 0;//fsb.list.size.w + fsb.split.size.w;
+
+ float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp);
+
+ int wDraw = (int)(wBmp * scale);
+ int hDraw = (int)(hBmp * scale);
+
+ #ifndef __linux__
+ surface.Filter(fsb.bitmap, (wWnd - wDraw) / 2, (hWnd - hDraw) / 2, 0, 0, wDraw, hDraw, wBmp, hBmp);
+ #else
+ // Until Filter / Stretch works with X
+ surface.Blit(fsb.bitmap, (wWnd - wBmp) / 2, (hWnd - hBmp) / 2, 0, 0, wBmp, hBmp);
+ #endif
+ }
+ else
+ {
+ surface.SetForeground(white);
+ surface.Area(0, 0, fsb.clientSize.w - 1, fsb.clientSize.h - 1);
+ }
}
- else
- result = NotifyNodeOpen(this.master, this, selection);
+ }
+
+ bool MenuOpen(MenuItem selection, Modifiers mods)
+ {
+ OpenNode();
+ }
+
+ bool OpenNode()
+ {
+ bool result;
+ FileSystemBoxSelection selection = this.selection.Copy();
+ FileSystemNode node = selection.node;
+ if(node && node.type.isFolder && bits.navigateFolders)
+ property::path = node.path;
+ result = NotifyNodeOpen(this.master, this, selection);
return result;
}
nameField.width = width - 80;
}*/
+ void ChangeViewType()
+ {
+ list.Clear();
+ list.ClearFields();
+ list.resizable = bits.details || bits.pathColumn;
+ list.moveFields = bits.details || bits.pathColumn;
+ list.hasHeader = bits.details || bits.pathColumn;
+ list.AddField(nameField);
+ if(bits.pathColumn)
+ list.AddField(pathField);
+ if(bits.details)
+ {
+ list.AddField(typeField);
+ list.AddField(sizeField);
+ list.AddField(modifiedField);
+ }
+ }
+
void Load()
{
// TODO: fix this!
(bits.foldersOnly && listing.stats.attribs.isDirectory) ||
(bits.filesOnly && listing.stats.attribs.isFile))
{
- FileSystemNode node = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
- DataRow row = list.AddRow();
- row.tag = (int)node;
- row.SetData(nameField, node);
- if(bits.details)
- {
- row.SetData(typeField, node.extension);
- row.SetData(sizeField, (void *)node.stats.size);
- }
+ FileSystemNode node = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
+ AddNode(node);
}
}
list.Sort(nameField, 1);
void LoadTree()
{
bool isRoot = !strcmp(path, "/");
- //char startPath[MAX_LOCATION];
+ char name[MAX_LOCATION];
FileSystemNode parent;
FileSystemNode node;
FileListing listing { path, extensions = extensions };
+
+ if(!isRoot)
+ GetLastDirectory(path, name);
+ else
+ name[0] = '\0';
/*if(!path)
GetWorkingDir(startPath, sizeof(startPath));
#ifdef __WIN32__
if(isRoot)
{
- root = FileSystemNode { loaded = true, childrenLoaded = true };
+ root = FileSystemNode { bits.loaded = true, bits.childrenLoaded = true };
AddTreeNode(root, true, false, null);
while(listing.Find())
{
info[0] = 0;
}
- parent = MakeFileSystemNode(listing.stats, name, listing.path, bits.previewPictures, displaySystem);
+ parent = MakeFileSystemNode(listing.stats, name, listing.path, false, bits.previewPictures, displaySystem);
if(info[0])
- parent.info = CopyString(info);
- parent.loaded = true;
+ parent.info = info; //CopyString(info);
+ parent.bits.loaded = true;
AddTreeNode(parent, !listing.stats.attribs.isDirectory, listing.stats.attribs.isDirectory, root);
if(!listing.stats.attribs.isDirectory)
- parent.childrenLoaded = true;
+ parent.bits.childrenLoaded = true;
}
node = FileSystemNode { name = msNetwork, type = network };
else
#endif
{
- root = MakeFileSystemNode(FileStats { attribs = FileExists(path)}, path, path, bits.previewPictures, displaySystem);
+ root = MakeFileSystemNode(FileStats { attribs = FileExists(path)}, name, path, false, bits.previewPictures, displaySystem);
AddTreeNode(root, false, true, null);
LoadTreeNode(root);
}
void LoadTreeNode(FileSystemNode node)
{
- if(!node.loaded)
+ if(!node.bits.loaded)
{
char path[MAX_LOCATION];
node.GetPath(path);
(bits.foldersOnly && listing.stats.attribs.isDirectory) ||
(bits.filesOnly && listing.stats.attribs.isFile)))
{
- FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
+ FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
AddTreeNode(child, true, false, node);
NodeChildLoad(child, node);
}
}
}
- node.childrenLoaded = true;
- node.loaded = true;
+ node.bits.childrenLoaded = true;
+ node.bits.loaded = true;
node.row.SortSubRows(false);
}
- else if(!node.childrenLoaded)
+ else if(!node.bits.childrenLoaded)
{
FileSystemNode child;
if(node.children.first)
{
for(child = node.children.first; child; child = child.next)
{
- if(!child.loaded)
+ if(!child.bits.loaded)
LoadTreeNode(child);
- else if(!child.childrenLoaded)
+ else if(!child.bits.childrenLoaded)
NodeChildLoad(child, node);
}
- node.childrenLoaded = true;
+ node.bits.childrenLoaded = true;
node.row.SortSubRows(false);
}
}
(bits.foldersOnly && listing.stats.attribs.isDirectory) ||
(bits.filesOnly && listing.stats.attribs.isFile))
{
- FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, bits.previewPictures, displaySystem);
- AddTreeNode(child, true, false, parent);
+ FileSystemNode child = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, displaySystem);
+ AddTreeNode(child, listing.stats.attribs.isFile, !listing.stats.attribs.isFile, parent);
added = true;
}
}
if(!added)
added = true;
}
- //parent.childrenLoaded = true;
+ parent.bits.childrenLoaded = true;
+ }
+
+ void AddNode(FileSystemNode node)
+ {
+ DataRow row = list.AddRow();
+ row.tag = (int)node;
+ node.row = row;
+ incref node;
+ row.SetData(nameField, node);
+ if(bits.pathColumn)
+ row.SetData(pathField, node.path);
+ if(bits.details)
+ {
+ if(node.type.isFile)
+ {
+ row.SetData(typeField, node.extension);
+ row.SetData(sizeField, /*(void *)*/node.stats.size);
+ }
+ row.SetData(modifiedField, node.stats.modified);
+ }
}
void AddTreeNode(FileSystemNode node, bool loaded, bool addLoader, FileSystemNode addTo)
row.tag = (int)node;
node.row = row;
row.SetData(null, node);
+ if(bits.pathColumn)
+ row.SetData(pathField, node.path);
+ if(bits.details)
+ {
+ if(node.type.isFile)
+ {
+ row.SetData(typeField, node.extension);
+ row.SetData(sizeField, /*(void *)*/node.stats.size);
+ }
+ row.SetData(modifiedField, node.stats.modified);
+ }
- node.loaded = loaded;
+ node.bits.loaded = loaded;
if(addLoader)
//AddTreeNode(FileSystemNode { }, false, false, node); // why would this create a compile error?
AddTreeNode(FileSystemNode { type = none }, false, false, node);
void DeleteNode(FileSystemNode node)
{
FileSystemNode child;
- for(; (child = node.children.first); )
- DeleteNode(child);
+ if(treeBranches)
+ {
+ for(; (child = node.children.first); )
+ DeleteNode(child);
+ }
list.DeleteRow(node.row);
node.Delete();
+ //delete node;
+ //Update(null);
}
}
#endif
*/
-public class FileSystemNode : struct
+public class FileSystemBoxSelection
{
public:
+ FileSystemNode node;
+ Array<FileSystemNode> nodes { };
+
+private:
+ FileSystemBoxSelection Copy()
+ {
+ FileSystemBoxSelection copy { node = node };
+ for(node : nodes)
+ {
+ copy.nodes.Add(node);
+ incref node;
+ }
+ return copy;
+ }
+
+ ~FileSystemBoxSelection()
+ {
+ nodes.Free();
+ }
+}
+
+class FileSystemNodeBits
+{
+ bool loaded:1, childrenLoaded:1, displayPath:1;
+};
+
+public class FileSystemNode
+{
+
+private:
+ FileSystemNodeBits bits;
+ char * path;
+ char * name;
+ char * extension;
+ char * label;
+ char * info;
+
+ ~FileSystemNode()
+ {
+ Free();
+ }
+
+public:
/*//LinkElement<FileSystemNode> link;
FileSystemNode parent;
FileSystemNode prev, next;
- bool loaded, childrenLoaded;
int indent;
- char * path;
- char * name;
- char * label;
- char * extension;
- char * info;
+
+ property char * path
+ {
+ set { delete path; if(value && value[0]) path = CopyString(value); }
+ get { return path; } isset { return path && path[0]; }
+ }
+ property char * name
+ {
+ set { delete name; if(value && value[0]) name = CopyString(value); }
+ get { return name; } isset { return name && name[0]; }
+ }
+ property char * extension
+ {
+ set { delete extension; if(value && value[0]) extension = CopyString(value); }
+ get { return extension; } isset { return extension && extension[0]; }
+ }
+ property char * label
+ {
+ set { delete label; if(value && value[0]) label = CopyString(value); }
+ get { return label; } isset { return label && label[0]; }
+ }
+ property char * info
+ {
+ set { delete info; if(value && value[0]) info = CopyString(value); }
+ get { return info; } isset { return info && info[0]; }
+ }
+
DataRow row;
OldList children;
_FileType type;
void GetPath(String outputPath)
{
- FileSystemNode up;
- if(parent)
+ if(path)
+ strcpy(outputPath, path);
+ else if(parent)
{
+ FileSystemNode up;
if(name)
strcpy(outputPath, name);
for(up = parent; up; up = up.parent)
PathCat(temp, outputPath);
strcpy(outputPath, temp);
}
+ /*else
+ {
+ /-*#ifdef __WIN32__
+ strcpy(outputPath, "/");
+ #else*-/
+ //strcpy(outputPath, name);
+ strcpy(outputPath, path);
+ PathCat(outputPath, name);
+ //#endif
+ }*/
}
- else
-/*#ifdef __WIN32__
- strcpy(outputPath, "/");
-#else*/
- strcpy(outputPath, name);
-//#endif
-
}
bool IsChildOf(FileSystemNode node)
for(child = children.first; child; child = child.next)
{
FileSystemNode copy { };
- copy.name = CopyString(child.name);
+ copy.name = child.name; //CopyString(child.name);
copy.type = child.type;
- fsb.AddTreeNode(copy, child.loaded, false, addTo);
+ fsb.AddTreeNode(copy, child.bits.loaded, false, addTo);
if(forceExpanded)
copy.row.collapsed = false;
if(recursive)
children.Delete(child);
}
//if(name)
+ delete path;
delete name;
+ delete extension;
delete label;
delete info;
}
}
//textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
+ surface.SetForeground(displayFlags.selected ? fsb.selectionText : fsb.foreground);
surface.TextOpacity(false);
surface.TextExtent(string, len, &w, &h);
h = Max(h, 16);
}
return node;
}*/
-static FileSystemNode MakeFileSystemNode(const FileStats stats,
- const char * fileName, const char * filePath,
- const bool previewPicture, const DisplaySystem displaySystem)
+
+FileSystemNode MakeFileSystemNode(
+ const FileStats stats,
+ const char * name,
+ const char * path,
+ const bool pathAddName,
+ const bool previewPicture,
+ const DisplaySystem displaySystem)
{
- int len = strlen(fileName);
+ int len = strlen(name);
char info[MAX_LOCATION];
- char name[MAX_LOCATION];
+ char name2[MAX_LOCATION];
char extension[MAX_EXTENSION];
FileSystemNode node { stats = stats };
- //if(stats.attribs.isFile) // TODO fix this in ecere
+ /*if(!pathAddName)
+ {
+ char o[MAX_LOCATION];
+ //char r[MAX_LOCATION];
+ //StripLastDirectory(path, o);
+ GetLastDirectory(path, o);
+ if(fstrcmp(name, o))
+ //if(!FileExists(path))
+ PrintLn("Stop!");
+ }*/
+ //if(stats.attribs.isFile) // TODO fix this in ecere -- WTH -- this has been fixed :/
if(stats.attribs.isDirectory)
{
extension[0] = '\0';
if(stats.attribs.isRemote) node.type = netDrive;
if(stats.attribs.isRemovable)
{
- if(fileName[0] == 'A' || fileName[0] == 'B')
+ if(name[0] == 'A' || name[0] == 'B')
node.type = floppy;
else
node.type = removable;
}
else
{
- GetExtension(fileName, extension);
+ GetExtension(name, extension);
strlwr(extension);
node.type = _FileType::SelectByExtension(extension);
}
if(stats.attribs.isDrive &&
- len > 3 && !strncmp(&fileName[1], ": [", 3))
+ len > 3 && !strncmp(&name[1], ": [", 3))
{
- strncpy(name, fileName, 2);
- name[2] = 0;
- strncpy(info, &fileName[4], len - 5);
+ strncpy(name2, name, 2);
+ name2[2] = 0;
+ strncpy(info, &name[4], len - 5);
info[len - 5] = 0;
}
else
{
- strcpy(name, fileName);
+ strcpy(name2, name);
info[0] = 0;
}
- node.path = CopyString(filePath);
- node.name = CopyString(name);
+ if(pathAddName)
+ {
+ bool isFile = stats.attribs.isFile;
+ bool isFolder = stats.attribs.isDirectory;
+ char full[MAX_LOCATION];
+ strcpy(full, path);
+ PathCat(full, name);
+ node.path = full; //CopyString(full);
+ }
+ else
+ node.path = path; //CopyString(path);
+ node.name = name2; //CopyString(name2);
if(info[0])
- node.info = CopyString(info);
- node.extension = CopyString(extension);
+ node.info = info; //CopyString(info);
+ node.extension = extension; //CopyString(extension);
if(node.type == pictureFile && previewPicture)
{
node.bitmap = Bitmap { alphaBlend = true };
- node.bitmap.Load(filePath, null, displaySystem);
+ node.bitmap.Load(path, null, displaySystem);
}
return node;