Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Define path inside Application forder writable
Forum Updated to NodeBB v4.3 + New Features

Define path inside Application forder writable

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 224 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheCeylann
    wrote on last edited by
    #1

    I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
    My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write.

    Pl45m4P JonBJ 2 Replies Last reply
    0
    • T TheCeylann

      I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
      My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write.

      Pl45m4P Online
      Pl45m4P Online
      Pl45m4
      wrote on last edited by
      #2

      @TheCeylann

      Use QStandardPath. There you can make sure that you get the home directory or desktop of the user on any computer.

      • https://doc.qt.io/qt-5/qstandardpaths.html

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Already told you here: https://forum.qt.io/topic/134385/using-text-file-in-resources-for-read-and-write-in-to-text-file/6

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        4
        • T TheCeylann

          I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
          My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @TheCeylann
          In addition to what the others are correctly telling you about using QStandardPaths, when an end user installs your app on their computer it may well be the case that they do not have permission to write anything into the executable folder and/or the folder where any app files were installed.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved