LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing to root directory

Why is it that we can't write to the root (C:) folder?  We need to copy some vxworks files from one dir to the root (C) where the processor looks for them.  Here is a VI we're trying to use for this purpose.
0 Kudos
Message 1 of 8
(3,524 Views)

You can copy to root folder. The vi is working fine, except that in the inner case you give a wrong path as  an input.

Hilight, use a probe, and you will see...

0 Kudos
Message 2 of 8
(3,520 Views)
Works for me (of course with a different source file). What error do you see? Also, using the string constant for the root and converting to a path seems a bit silly. Why not just use a path constant?
0 Kudos
Message 3 of 8
(3,517 Views)

You should never use strings as paths, except for embedding in string displays (such as your error case)  or OS specific tasks and (e.g. system exec).

Use path datatypes, not strings. Use "build path" and "Strip path" and use string operations only for the "name" portion of paths. This makes your code universal.

Use plain path constants and eliminate all the "string to path" and "path to string" primitives. (for a similar issue, see e.g. this example). Things will fall much better in place.

Also, your "not a path" primitive use seems incorrect because it only checks if the path is properly formed, it does NOT check if the file or path actually exists. There is another tool to do that.

Here's a picture of how I would probably do some of that. 😉

 



Message Edited by altenbach on 03-01-2008 03:31 PM
0 Kudos
Message 4 of 8
(3,512 Views)
You can wire an error cluster directly to the "?" of a case structure too.
 
0 Kudos
Message 5 of 8
(3,494 Views)


Pnt wrote:
You can wire an error cluster directly to the "?" of a case structure too.

Not in this case, because the "check if file or folder exists" does NOT output an error, even if the file does not exists.
 
You are probably thinking about using the legacy method to do this task, using "file info" and then see if an error is generated.
 
0 Kudos
Message 6 of 8
(3,477 Views)

I was referring to mrbean's vi (i did not made it clear).

 As a general coding style: No need to unbungle an error cluster, to wire it to a case structure.

0 Kudos
Message 7 of 8
(3,460 Views)


Pnt wrote:
I was referring to mrbean's vi (i did not made it clear).
Ahh, OK. 🙂
0 Kudos
Message 8 of 8
(3,450 Views)