mirror of https://github.com/vitalif/phantomjs
Implement fs.readLink to read symlink target.
http://code.google.com/p/phantomjs/issues/detail?id=3291.5
parent
c2c80c0e96
commit
c6091b48c1
|
@ -220,6 +220,12 @@ QVariant FileSystem::lastModified(const QString &path) const
|
|||
return QVariant(QDateTime());
|
||||
}
|
||||
|
||||
// Links
|
||||
QString FileSystem::readLink(const QString &path) const
|
||||
{
|
||||
return QFileInfo(path).symLinkTarget();
|
||||
}
|
||||
|
||||
// Tests
|
||||
bool FileSystem::exists(const QString &path) const
|
||||
{
|
||||
|
@ -446,6 +452,7 @@ void FileSystem::initCompletions()
|
|||
// functions
|
||||
addCompletion("list");
|
||||
addCompletion("absolute");
|
||||
addCompletion("readLink");
|
||||
addCompletion("exists");
|
||||
addCompletion("isDirectory");
|
||||
addCompletion("isFile");
|
||||
|
|
|
@ -116,6 +116,9 @@ public slots:
|
|||
bool changeWorkingDirectory(const QString &path) const;
|
||||
QString absolute(const QString &relativePath) const;
|
||||
|
||||
// Links
|
||||
QString readLink(const QString &path) const;
|
||||
|
||||
// Tests
|
||||
bool exists(const QString &path) const;
|
||||
bool isDirectory(const QString &path) const;
|
||||
|
|
|
@ -30,4 +30,9 @@ describe("Files and Directories API", function() {
|
|||
fs.removeTree(TEST_DIR);
|
||||
expect(fs.changeWorkingDirectory(START_CWD)).toBeTruthy();
|
||||
});
|
||||
|
||||
// TODO: test the actual functionality once we can create symlink.
|
||||
it("should have readLink function", function() {
|
||||
expect(typeof fs.readLink).toEqual('function');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue