[Qt-creator] qbs issue with TextFile

Theo de Vries t.j.a.devries at gmail.com
Mon Aug 12 10:37:12 CEST 2013


Elsewhere (http://qt-project.org/forums/viewthread/31038/) I reported my
issue with manipulating TextFiles with qbs. Am I the only one having
trouble? I would appreciate it if someone could confirm / deny this.

minimal qbs file to reproduce:

import qbs 1.0

import qbs.fileinfo as FileInfo


Project {

  property string name: "helloWorld"


  Product {

    type: [ "someOutput" ]

    name: project.name + ".html"


    Transformer {

      // no inputs -> just a generator

      Artifact {

        fileName: "test.txt"

        fileTags: "conf"

      }

      prepare: {

        var cmdConf = new JavaScriptCommand();

        cmdConf.confContent = 'Hello World';

        cmdConf.description = "generating " + output.fileName;

        cmdConf.highlight = "codegen";


        cmdConf.sourceCode = function() {

          print("Starting...");

          var file = new TextFile(output.fileName, TextFile.WriteOnly);

          file.truncate();

          file.write(confContent);

          file.close();

        }

        return cmdConf;

      }

    }

  }

}



Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20130812/b00f4b08/attachment.html>


More information about the Qt-creator mailing list