Forums

OverviewV-Play 1 SupportreadFile and PC/Android issues › Reply To: readFile and PC/Android issues

OverviewV-Play 1 SupportreadFile and PC/Android issues › Reply To: readFile and PC/Android issues
#6240

Christian
V-Play Team

Hi Michael,

the files given with filteUtils.readFile() are read relative to the qml folder of your qml file where you call it, if an absolute url is given. An absolute url either is defined if you add a property url, or use Qt.resolvedUrl(). If just a string is provided, the path is relative to the StorageLocation. See the docs of readFile() for further infos: http://v-play.net/doc/fileutils.html#readFile-method

So if you have a file “testFile.txt” and put it in the same folder as our main.qml file and then call there the following, this is working as expected, across all platforms:

var storageData = fileUtils.readFile(Qt.resolvedUrl("testFile.txt"))
console.debug("storageData:", storageData)

Cheers, Chris

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support