Results 1 to 2 of 2

Thread: Cannot copy js file from resource to file system

  1. #1
    Join Date
    Mar 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Cannot copy js file from resource to file system

    Hi
    I got the following code to copy some resource embedded files to file system.
    It works fine with "css" and "htm" files but not with a "js" file (size 480kb), no errors issued but only the file name is there with size =0; what is wrong here?
    Thanks.

    Qt Code:
    1. QFile file("jscript.js");
    2. if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
    3. QMessageBox::information(this, "", tr("Unable to open file"), file.errorString());
    4. return;
    5. }
    6. if(!file.copy(":/scripts/jscript.js", "F:\\....\\jscript.js")
    7. QMessageBox::information(this, "", file.errorString());
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cannot copy js file from resource to file system

    Is this you actual code?
    How is trying to open the jscript.js file for reading related to the copying of the resource file to disk?

    Line 7 doesn't make any sense, the static copy() method used in line 6 cannot affect the file instance "file".

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 28th June 2013, 02:44
  2. Replies: 1
    Last Post: 7th May 2013, 01:34
  3. Replies: 0
    Last Post: 12th April 2010, 08:05
  4. resource file
    By kavinsiva in forum Newbie
    Replies: 4
    Last Post: 18th August 2009, 23:28
  5. copy and run a .exe file in another system
    By sabeesh in forum Installation and Deployment
    Replies: 3
    Last Post: 22nd August 2007, 11:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.