found an error / обнаружил ошибку - Forum

Forum Navigation
You need to log in to create posts and topics.

found an error / обнаружил ошибку

The project itself is located in the (documents) folder
When I compiled the project, I pointed to a different folder (on the desktop).
As a result, in the project, the program, when specifying pubDir, considers that the root of the project is the folder into which I compiled the project. I am using windows 10

Сам проект находится в папке (документы)
Когда я скомпилировал проект, я указал на другую папку (на рабочем столе).
В результате в проекте программа при указании pubDir считает, что корнем проекта является папка, в которую я скомпилировал проект. Я использую windows 10

video https://youtu.be/n15x20bKPdo

@lolo not sure if I'm understanding you but [PubDir] stores the path where your executable is located.

Yes, it uses the address of the executable file.
And when I work on a project, it causes confusion

Да, использует адрес исполняемого файла.
И когда я работаю над проектом из-за этого возникает путаница

@lolo Hey! During test compilation (F9) the variable [PubDir] stores the path to the folder with the project. If you make the final compilation in any folder, then an independent executable file will be created. If you then run this executable file, the variable [PubDir] will store the path to the folder with this executable file. Wherever he is.

 

but then the variable [PubDir] should be overwritten in the root of the project when it is opened

но тогда переменная [PubDir] должна быть перезаписана в корне проекта при его открытии

@lolo

This variable always stores the current path to the folder in which the executable file is located. It doesn't matter where you move the project, this variable will display the path to the folder from which the executable file is launched. Publishing directory (PubDir).

@vadim

Apparently we do not understand each other or are fighting for two different truths), [pubDir] returns the address of the folder from which the program was launched.
But I do not start the program, I am working on the project and the working folder of the project is located at a different address, but when I start the preview, the program selects not the project folder, but the folder in which the compiled project was once, this causes confusion for almost a week I could not understand why mine working project suddenly stopped reading keys and ini file values)).
According to the idea, if I'm working on a project, then [pubDir] should point to the project folder, and if I run a compiled project, then [pubDir] should point to the finished program folder, but it turns out that [pubDir] takes the address from the project compilation settings.

Видимо мы не понимаем друг друга или боремся за две разные правды ), [pubDir] возвращает адрес папки из которой произошел запуск программы.
Но я не запускаю программу я работаю над проектом и рабочая папка проекта находится по другому адресу, но когда я запускаю предпросмотр, программа выбирает не папку проекта а папку в которой когда-то был скомпилированный проект, это вызывает путаницу, я почти неделю не мог понять почему мой рабочий проект вдруг перестал читать  ключи и значения ini файла )) .
по идеи, если я работаю над проектом, то [pubDir]  должен указывать на папку проекта а если запускаю скомпилированный проект, то [pubDir] должен указывать на папку готовой программы, но тут получается, что [pubDir]  берет адрес из настроек компиляции проекта.

Uploaded files:
  • You need to login to have access to uploads.

@vadim

Ладно, буду компилировать в папку проекта

@lolo

Yes, you are absolutly right. Indeed, if you select a different folder for the final compilation, then PubDir will store this path for the subsequent test compilation of the project. I haven't come across this yet. In theory, PubDir should in any case store the path to the folder of the executable file from which it is called to life. But it turned out that this is not the case.
Thank you! I'll know.

 

Ладно, буду компилировать в папку проекта

Да, думаю сейчас это единственный выход.

@lolo

If this helps, when you test your project, it will create a temporary EXE with the addition of _Test in the name. This EXE will be created in the folder that you last compiled when you selected Compile/Publish. Or alternatively, it will be created in the folder that you saved your project if you haven't yet compiled anything. You need to be aware of how you locate external files within your code, for instance, if you have a picture object you may use C:\MyProject\MyPicture.jpg vs [PubDir]MyPicture.jpg.
C:\MyProject is a specific folder. [PubDir] is the current folder where your EXE resides whether or not you're running it in debug mode or compiled. If you use [PubDir]MyPicture.jpg and your last compiled folder is not C:\MyProject then your _Test run will not find MyPicture.jpg.

There are several different ways you can locate external files. You need to use the method that best suits your situation.

luishp has reacted to this post.
luishp