Cannot create a .db file in the folder data

I use this code

const QString fileName = QString("rules.db");
    QString dataFolder = QDir::homePath();
    QString newFileName = dataFolder + "/" + fileName;
    QFile file(newFileName);

    if(file.exists())
    {
        qDebug()<<"FILE EXISTs";
    }

leader. Exists() returns false. I don't understand what I'm doing wrong :-(

.the calling on QFile creates the file if it does not exist.

Tags: BlackBerry Developers

Similar Questions

  • Cannot create a .db file in the assets folder

    I am trying to create a quizz.db file in the current folder by creating first a temporary quizz.db in the folder data and then creating tables inside and then copy it in the current folder. By debugging code, it shows that the folder is created. But I can't find it in the current folder. Here is the code

    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    using namespace bb::data;
    
    SQLTest::SQLTest(bb::cascades::Application *app): QObject(app)
    {
        const QString fileName = QString("quizz.db");
        QString dataFolder = QDir::homePath();
        QString newFileName = dataFolder + "/" + fileName;
        QTemporaryFile file(newFileName);
    
        // Open the file that was created
        if (file.open())
        {
            // Create an SqlDataAccess object
            SqlDataAccess sda(newFileName);
    
            // Create a table called Employee in the database file
            sda.execute("CREATE TABLE Employee( firstName VARCHAR(50),lastName VARCHAR(50), salary INT);");
    
            // Insert employee records into the table
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Mike\", \"Chepesky\", 42000);");
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Westlee\", \"Barichak\", 55000);");
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Ian\", \"Dundas\", 47000);");
            if(sda.hasError())
            {
    
            }
            else
                copyFileToAssetsFolder("quizz.db");
        }
    }
    void SQLTest::copyFileToAssetsFolder(const QString fileName)
    {
        QString appFolder(QDir::homePath());
        appFolder.chop(4);
        QString originalFileName = appFolder + "app/native/assets/" + fileName;
        QFile newFile(originalFileName);
    // If I enable this `if` condition the code satisfies it and removes the quizz.db file and then it satisfies the next `if` condition and successfully copies the quizz.db file from `data` folder to `assets` folder.
        /*if(newFile.exists())
            QDir().remove(originalFileName);*/
        // this `if` condition is not satisfied. Which should mean the quizz.db file has been created on assets folder.
        if (!newFile.exists())
        {
            // If the file is not already in the assets folder, we copy it from the
            // data folder (read and write) to the assets folder (read only).
    
            QString dataFolder = QDir::homePath();
            QString newFileName = dataFolder + "/" + fileName;
            QFile originalFile(newFileName);
    
            if (originalFile.exists())
            {
                // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb
                QFileInfo fileInfo(originalFileName);
                QDir().mkpath (fileInfo.dir().path());
    
                if(!originalFile.copy(originalFileName)) {
                    qDebug() << "Failed to copy file to path: " << originalFileName;
                }
            } else {
                qDebug() << "Failed to copy file data base file does not exists.";
            }
        }
    
       // mSourceInDataFolder = newFileName;
    }
    

    If activate the commented "If" condition of "copyFileToAssetsFolder" int he removes already created quizz.db file in the current folder (that Im unable to find) and goes inside the next ' if' and copy the quizz.db created on the folder "data" of active fodler. But in any case I don't find the quizz.db in the current folder. I really need help with this quickly. Thank you.

    Thanks to read this to learn why you can have an application change the assets folder: https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.d...

  • How can I make use of TC partitions and make sure that the file analysis is on the right partition?  I do not see the partitions that I have done in the Finder, but I can drag and drop the files in the folder 'Data' unique under Finder/Shared/TC.

    MacBook Air, OSX 10.10.3, 128 GB; 2 TB Time Capsule ME177LL/A.

    Final objective: use Time Capsule as a Time Machine for my MacBook Air and as a storage solution for large files that I don't want permanently on my MacBook Air.

    So far, I've implemented the TC and set up Time Machine on the TC.  I was able to create 2 partitions on the TC using disk utility then that TM was a backup and the disk was recognizable in disk utility.

    Under Finder/shared, I see the TimeCapsule 'airport', and when I click on it it is a file called "Data".  I was expecting to see my two partitions here.  Under 'Features' is a ' Zissou31 MacBook Air (3)"sparsebundle file and I can also create folders here and drag and drop files on the TC here.  I can see the partitions in disk utility, but how do I see/use the partitions I created in the Finder?

    I fear that this may not be set up correctly and I'm either losing on an entire partition I created or these files dragged/dropped may be at risk of overwriting of TimeMachine.  How can I make sure that the file analysis is on the appropriate partition?

    I disabled TimeMachine and go back to see if I could 'point' to one of the partitions, but the "Data" folder is the only thing that TimeMachine seen.  How do I point time Machine for one of the partitions?

    Thank you!

    In addition, in disk utility, I can see one of the partitions TC is related to the time Machine, indicated by the icon Time Machine green bottom left, but two partitions seem to fall under "Zissou31 of the MacBook Air (3) .sparsebundle.

  • Cannot create a PDF file after the upgrades: Adobe 9.2 and Mac OS 10.6.2

    After the upgrade to Adobe Professional 9.2 and Mac 10.6.2 I lost the ability to create PDF files.

    The printer Adobe (display says that the printer is v. 9.0) indicates the status of the job as "Mistake" and has the following message; "You must install the software to use this printer. To install the software, choose software update from the Apple menu. If the software for your printer is not available in software update, contact the manufacturer of your printer. »

    I get errors when I try to create a PDF from a Web page.

    I get the following error when I try to create a pdf from a word file: "Acrobat cannot open 'AAA.docx' because it is not a type of supported file or because the file has been damaged (for example, it was sent as an attachment to e-mail and has not been correctly decoded).

    To create an Adobe PDF document, go to the source application. Then print the document in Adobe PDF format".

    (I can create a PDF from jpg files... but I never really have a need to do this...)

    I uninstalled Adobe Professional by using the uninstall program (then emptied the trash and restart), then reinstalled Adobe Professional from disk (and restarted).  After the reinstallation, I always get the same problems, even if I get no error message until Adobe Professional updates from 9.0 to 9.2.  Before the upgrade Adobe, v9.0 attempts to print to pdf just act as the pdf is created (no error message), but I do not get a backup fast, nor is a new pdf no matter where the document is located.

    Help, please!

    With OSX.6.x, the possibility of using the Adobe PDF printer has been lost. See the ad at the top of this forum (known issues with Snow Leopard).

  • Error: failed to create or save new files in the folder where it was downloaded during the upgrade from Windows Vista to Windows 7

    Original title:

    Attempt to upgrade Windows Vista to Windows 7

    I try to update my Windows Vista to Windows 7. I bought to download the rom update the Microsoft store and downloaded, but when I try to start the upgrade I have a stateing message that it is impossible to create or save new files in the folder where it was downloaded. I checked the security permissions in the file and made sure that no programs are 'read only', but it won't always go beyond this point!

    Hello

    What is the edition of Windows Vista installed on the computer?
    Make sure that you upgrade to the correct version, some versions of Windows cannot be upgraded with the installation disc you are trying to use. For example, you cannot upgrade a 32-bit version of Windows to a 64-bit version, or upgrade a higher edition of Windows like Windows Vista Ultimate Edition, to a lower edition, such as Windows 7 Edition Home Premium. If this is the case, you will need to use the custom during installation option.
    Before you attempt to upgrade, please run the Windows 7 upgrade Advisor:
    http://Windows.Microsoft.com/en-us/Windows/downloads/Upgrade-Advisor
    Also, check if your computer is compatible for Windows 7, using the Compatibility Center:
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx
    To learn more about the upgrade process, please visit the link below:
    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-Vista-to-Windows-7
    I hope that helps!
  • En5.1: Cannot create a DVD disc or DVD folder, but can create a Flash version that works according to the needs.

    Yet 5.1 cannot create a DVD disc or DVD folder, but can create a Flash version, including a Manger Menu HD & HD submenu nursery that works as required.

    The script contains two M2v with AVI files associated files.

    An anomaly, when rendering > motion menu is executed, the Menu made progress has elapsed time: indicator checking the time, but nothing happens. I cancelled the progress to return after 8 minutes window.

    The Flash version works fine. How should I proceed with the DVD disc or DVD folder versions?

    two M2v file with the associated AVI files.

    Do you mean associated wav files?

    M2v files show that "do not transcode" for DVD transcoding status?

    What happens when you try to build on the record?

  • Give permission to the domain users to replace the file in the folder created by domain admin

    We have a domain controller in our network. also we have the domain users and domain administrator. We create a batch file that copies a file to the folder by using a script to the server policy when users open a session input/output. However if the admin area access system cant use overwrite file in the folder. We want to give permission to the domain users to replace the file in the folder created by the domain administrator.

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en/category/w7itpro, w8itpro, windowsvistaitpro, windowsxpitpro, windowsintune

    Hope the information is useful.

  • Cannot copy the driver files in the folder of the Windows driver

    Title: windows 7 drivers
    Hello

    I am trying to copy a driver file in the folder of the windows driver, when I get the message so I pantyhose administration required and when I OK this file does not copy, even if I am logged in as an administrator and in the properties of the folder admin log also scored as the owner.
    I am trying to install a virtual CD-ROM, which is a Microsoft product.
    Can anyone suggest a way around that?
    Thank you

    See if that solves your problem to get a virtual CD-ROM in Windows 7...

    http://www.pctips3000.com/how-to-enable-virtual-CDDVD-ROM-drive-in-Windows-7/

  • Cannot save settings: unable to create a configuration file for the required configuration object

    When I try to open the application in the administrator account it say - could not save the settings: unable to create a configuration file for the required configuration object

    Thanks for the reply.i think that a virus changed I scan my computer and discovered C:\users\jason\AppData\local\temp\low\temporary internet files\content. IE5\TLIFXGRH\ why is Task Manager disabled people [1]

  • Move the file in the folder of the same name in AppleScript

    I had a problem with the script below. Basically, on the execution of the script, I want to create folders based on the name of the file and move the files in the files of autocorrelation. However, at the minute, that I'll have to choose the folder in which the script should run.

    Folder to choose a folder

    say application 'Finder '.

    located fileList to the name of every file in Folder with name extension is "m4v".

    end say

    the value point text delimiters to ".".

    Repeat with dittos in list of files

    get each text element of dittos

    masterFile defined in the point 1 of the result

    say application 'Finder '.

    create a new folder to Folder with properties {name: masterFile}

    move (each file from the folder Folder whose name contains masterFile) will cause

    end say

    end Repeat

    Ideally, I would like it to run automatically, but the folder is on an external hard drive. (\Volumes\Lacie\Movies). and I had problems to use the POSIX and 'alias' to properly re-create the path of the file desired.

    Any help would be greatly appreciated. Thank you!

    Hello

    You can try something like the AppleScript script which is a simple shell script wrapper.

    set d to (choose folder)'s POSIX path
    do shell script "/bin/bash -s <<'EOF' - " & d's quoted form & " 2>&1
    cd \"$1\" || exit
    shopt -s nullglob
    for f in *.m4v
    do
        m=${f%.*}
        [[ -d $m ]] || mkdir -p \"$m\" || continue
        mq=$(sed 's/[^[:alnum:]]/\\\\&/g' <<< \"$m\")   # quote meta characters for regex
        find -E . -depth 1 -type f -iregex '.*/'\"$mq\"'.[[:alnum:]]+$' -print0 | xargs -0 -J% mv % \"$m\"
    done
    EOF"
    

    For example, given that you choose/path/to/directory in the folder - source

    Input state:

    /path/to/directory/abc.m4v
    /path/to/directory/abc.txt
    /path/to/directory/abcd.m4v
    /path/to/directory/abcd.txt
    

    Status of the output:

    /path/to/directory/abc/abc.m4v
    /path/to/directory/abc/abc.txt
    /path/to/directory/abcd/abcd.m4v
    /path/to/directory/abcd/abcd.txt
    

    Briefly tested under OS X 10.6.8 but no guarantee of any kind. Please make sure that you have a full backup of the original files and directories before you run this kind of script.

    Good luck

    H

  • Download the files from the folder on the external drive

    I have this script that opens the most recent file in a folder.

    However I have now moved to an external drive.

    I thought I would use this line

    last element of the value latestFile (sort (get the files in the folder "HotFolderA" of the "Dropbox folder" from the folder "CloudStorage" in the folder "Volumes" of the file ((path to the startup disk))) by creation date) as alias

    but that

    Result:

    error "' Finder has been an error: cannot get the file \"Volumes\ ' startup disk. " ' number-1728 of the folder "Volumes" of startup disk

    How can I do it keep this method?

    Matt

    tell application "Finder"
      set latestFile to last item of (sort (get files of folder "AA" of folder (path to desktop folder)) by creation date) as alias
    set fileName to latestFile's name
    
     open latestFile
    end tell
    

    You used the backslash \ (like Windows) instead of the slash /.

  • The user may not delete the file from the folder on the server but can rename file

    Hi all

    Please suggest how to give permission to some folder so that the user may not delete all the files in the folder but can create, update, or RENAME the folder.
    I gave permission where user is not able to delete the file, but the user is also able to rename the file or folder in this specific folder.

    Thanks in advance.

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en-us/winserverfiles/threads

  • In Windows Explorer. A dated file say 12/02/2000. When you click the folder, the files in the folder bear different date. Why is it so.

    ORIGINAL TITLE: I use Windows xp.

    I use Windows xp. In Windows Explorer. A dated file say 12/02/2000. When you click the folder, the files in the folder bear different date. Why is it so. To update the files, we should see the dates of the files instead of the dates of the folder. right? Why is there such a difference?

    My copy of Windows XP works the same as yours.  Apparently the date folder is not updated when the content is, that fact make some sense as the folder itself is not updated when new content is created in the it.

  • I can see other computers on a network of peer to peer windows XP but cannot access their shared files and the shared printer.

    I can see other computers on a network of peer to peer windows XP but cannot access their shared files and the shared printer. The computers are connected by a switch, fixed IP addresses that are correctly configured and point to a DNS server outside the network. When I try to open the icon for one of the computers, he asked for credentials. I try to type the user name for the computer that is sharing the resource and the password. It is the user account whose computer is loged on and belongs to the Administrators group. for example: user name (Computer1\username) password (password). It does not work. The Windows Firewall is disabled on all computers. It worked well there 2 days. I can't find anything wrong with the network settings. Does anyone have a solution? Thank you.

    If the portion of the machine has activated - Simple file sharing (i.e. it is XP Home or it is XP Pro with Simple (default) file sharing) - while all file sharing connections authenticate as user 'guest '.  It will not matter what username / password you provide, it will attempt to authenticate as 'guest '.  If the guest user has received a password or the guest account is not active, you will experience the symptoms you describe.

    If the serving machine running XP Pro and Simple file sharing is disabled, then you should be able to connect by specifying the user as computer\user and the password to connect.  To turn off Simple file sharing:

    "How to disable the file sharing simple and how to set permissions on a shared folder in Windows XP"
      <>http://support.Microsoft.com/kb/307874 >

    Also:
    "Description of the account in Windows XP"
      <>http://support.Microsoft.com/kb/300489 >

    HTH,
    JW

  • Impossible to rename the files in the folder "" downloads ".

    I can not rename all the files in the folder "downloads" on my computer Windows 7 ". I don't get an error message, it just does not get renamed. Happens with new records and old folder that already could be renamed. Sometimes with the right click 'Rename' way and Captain F2. It happens also if I press 'Enter' or if I just click outside the folder after renaming it.

    This is the kind of annoying to have three folders called "New folder (2)" etc. may not be renamed.
    I saw 1 post this topic on another forum, but no solution, so I thought I'd ask. It has been like this for a long time, and I don't remember if a special event or a well triggered it.

    Well, it happened to me and I just thought about it.


    See if you use a shortcut to the folder. If you are, try to enter the folder path (usually C:\Users\*Name of the user\Downloads) and see if you can rename the things out there. If you can, just press Backspace and create a shortcut from there.
    In my case, this problem happened because I accidentally deleted the shortcut I used for this folder, and to make the shortcut again once I used the fuction 'Search' to find and create the .encre. But when I did, the Windows 7 created the shortcut with the search path, being % search % downloads and so on. What is the fuction 'Rename' to stop working.]
    Weird, for sure. But okay, I worked here. Heh

Maybe you are looking for