Home » U++ Library support » FileSel&FileList, Path » FindFile.IsSymLink() broken
FindFile.IsSymLink() broken [message #22604] |
Thu, 30 July 2009 11:03  |
sam_
Messages: 4 Registered: July 2009 Location: Pazrava pri Puchove
|
Junior Member |
|
|
Hi all. I know it's not very polite to introduce myself with bug report, but...
I would expect following code snippet to return true for "link" (tested on Linux Mint 7.0; based on Ubuntu Jaunty):
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
String parentDir = GetFileDirectory(GetExeFilePath()), targetDir = AppendFileName(parentDir, "dir");
//RealizeDirectory(targetDir);
//Sys(Format("ln -s %s link", targetDir));
Sys(Format("ln -s %s link_to_dir", GetExeFilePath()));
FindFile ff(AppendFileName(parentDir, "*"));
while (ff.Next()) {
Cout().PutLine(Format("%s: %s", ff.GetName(), ff.IsSymLink() ? "true" : "false"));
}
Cout().PutLine(Sys("ls -la " + parentDir));
DeleteFile(AppendFileName(parentDir, "link"));
DirectoryDelete(targetDir);
}
According to http://manpages.ubuntu.com/manpages/jaunty/en/man2/stat.2.ht ml problem is in stat() call being used instead of lstat()
If this behaviour was actually intended, I suggest adding default parameter to both FindFile constructors:
FindFile(bool use_lstat = false);
FindFile(const char *name, bool use_lstat = false);
or perhaps
FindFile(const char *name, bool use_lstat = false);
bool Search(const char *path, bool use_lstat = false);
My preference is to use lstat() only. Thanks for great framework, Lubos
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 11:10:30 CEST 2025
Total time taken to generate the page: 0.00797 seconds
|