Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Developer
Posts: 2
Registered: ‎08-06-2014
My Device: Z10
My Carrier: -
Accepted Solution

Problem using QFileSystemWatcher in /accounts/1000

[ Edited ]

Hi all,

I try to detect file changes with a QFileSystemWatcher in the "accounts/1000" directory. However, it does not work.

Parts of my code:

QFileSystemWatcher * watcher = new QFileSystemWatcher(this);
watcher->addPath("/accounts/1000/");
connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(contentChanged(const QString&)));

...    

void App::contentChanged(const QString & path){

    qDebug() << "CONTENT CHANGED";

}


The problem is that contentChanged() gets never called, even if there are changes in the directory.


Error log:


QFileSystemWatcher: failed to add paths: /accounts/1000/
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Operation not permitted


Could you please tell me how to implement a QFileSystemWatcher which detects file changes in the "/accounts/1000/" directory?

Thanks a lot!
Chris

Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Problem using QFileSystemWatcher in /accounts/1000

I doubt you can, you don't have permission to access that folder. If you have the shared files permission, you can access what is now "accounts/1000/shared", but I wouldn't hardcode it like that. You should access it through your apps sandbox, as there is no guarantee that won't change. If your app is in the enterprise perimeter, for example, it's a different path.

 

More details on the file system here:

 

https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_syst...

 

 

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
New Developer
Posts: 2
Registered: ‎08-06-2014
My Device: Z10
My Carrier: -

Re: Problem using QFileSystemWatcher in /accounts/1000

Thanks for your reply! I have feared that it is not possible...
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Problem using QFileSystemWatcher in /accounts/1000

Out of curiousity, what is your usecase?

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker