LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Probléme de chemin avec des espaces dans les noms de fichier

Solved!
Go to solution

Bonjour,

 

j'ai créé des exécutables qui sont installés dans ce dossier (C:\Program Files (x86)\Position-V4). et des fichiers installés dans ce dossier (C:\Program Files (x86)\Position-V4\data\Fichier)

A partir d'un exécutable, je dois remplacer ou remettre à jour ces fichiers. Mon chemin est correct, mais cela ne fonctionne pas. Est-ce que cela n'est pas dû à un problème d'espace dans le nom de fichier?

Est-ce qu'il y a une solution pour palier à ce problème sans changer la destination de mes fichiers ?

 

Merci pour vos réponses.

0 Kudos
Message 1 of 5
(126 Views)

@nimunoel wrote:

Hello,

 

I have created executables which are installed in this folder (C:\Program Files (x86)\Position-V4). and files installed in this folder (C:\Program Files (x86)\Position-V4).

From an executable, I need to replace or update these files. My path is correct, but it doesn't work. Isn't this due to a space problem in the filename?

Is there a solution to this problem without changing the destination of my files?

 

Thank you for your answers.

Translated with DeepL.com (free version)


Did you get an error message?

Are you really sure you have the correct path? Did you check with a path indicator in the executable?

Depending on how you get the path there might be different results between development environment and executable. If you use "Current VI's Path" in the executable the path will have "...\MyExecutable.exe\..." in it.

 

Another issue might be missing permissions to write in C:\Program Files, because this normally is a protected directory. If you created an installer for your executable you can check in "Build Specifications" -> "Source File Settings" to "Unlock" the installation path.

 

 

 

0 Kudos
Message 2 of 5
(110 Views)
Solution
Accepted by topic author nimunoel

Storing files that you need to have write permissions from your application under C:\Program Files (x86) or C:\Program Files is generally considered very bad form. Microsoft changed this directory to be read only except for elevated users ca. Windows 7, because it is a security risk to have everyone being able to write there.

 

Yes I know, LabVIEW does it too for its own directories, but one going wrong doesn't make it right.

 

You should instead look at alternative locations to be future proof, as new Windows versions might eventually tighten down security even more and not let you change the permissions for normal users like that, without first sending you through several hoops and loops and then failing with an obscure error message anyhow.

 

Take a look at "Functions:Programming:File I/O:File Constants:Get System Directory.vi". This VI lets you find several different file locations that can let you find a user writeable location:

 

If the user should be able to easily find the file you can use one of the User Home or User Documents directories and if it should be accessible to any user on your computer you could use Public Documents.

 

If you want to hide the file from the user you can select User Preferences (if the configuration should be user specific for your application) or Public Preferences (if every user on your computer should get the same settings).

 

It is good form to create your own company/application specific directory in any of these locations to store your files in.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 5
(102 Views)

Hello, thank you for your reply. I'm going to try the solution by modifying my installer.
Because I don't get any error messages and I'm sur for the path.

0 Kudos
Message 4 of 5
(85 Views)

Hello, thank you for your reply.
You do need to think about managing Windows

 

0 Kudos
Message 5 of 5
(84 Views)