Comments: Optimizing Current Path

I have seen this type of thread more than once, and each reply (that I have noticed) seems to get a different VI or sub VI for the same solution. Thought I would start up a "optimize this" thread to get the best general solution. The one I made is smaller than most and should work within Windows, but relies on finding the first period in the path string. Does this have any obvious problems I have over looked or can this have unintended side effects on other platforms? Just curious...
Attachments:
RelPath.vi ‏13 KB

Hi Chaos,
I haven't looked at any of the "other" posts that you are referring to, but I'll throw in my 2 cents worth. The only problem with your approach is (like you mentioned) it relies on there being a "." in the file name. Most of the time this will be okay since most files have a ".ext", but not all files have extensions. For this reason, I attached a VI written in 7.1 that reverses the string and then searches for the first "\". It then reverses the string back to make the relative path. I can't think of any circumstances where this would back fire (I can't think of any circumstances where there wouldn't be a "\" in the path).
Hope this helps!
Travis H.
National Instruments
Travis H.
LabVIEW R&D
National Instruments
Attachments:
RelativePath.vi ‏14 KB

Similar Messages

  • How to get the current path of my application in java ?

    how to get the current path of my application in java ?
    thanks

    To get the path where your application has been installed you have to do the following:
    have a class called "what_ever" in the folder.
    then you do a litte:
    String path=
    what_ever.class.getRessource("what_ever.class").toString()
    That get you a string like:
    file:/C:/Program Files/Cool_program/what_ever.class
    Then you process the result a little to remove anything you don't want:
    path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
    //Might be a little error here but you should find out //quickly if it's the case
    And here you go, you have a nice
    C:/Program Files/Cool_program
    which is the path to your application.
    Hooray

  • Get current path in Java LINUX?

    Hi,
    I m trying to get the current path of file using the getAbsolutePath.Its works fine (gets the current working directory) in Windows both in debug & release mode.Whereas, in LINUX ,It is not working.
    i.e.,It gets home path instead current path while running in release(by clicking jar file).
    File objfile = new java.io.File("SampleCloud.txt").getAbsoluteFile();
    JOptionPane.showMessageDialog(null, objfile.getAbsolutePath());
    Message box display home path instead of current path on linux.
    I dont know why its so.Ur help would be appreciated.
    System.getProperty("user.dir")
    I used it but its also taking the home dir path on linux
    Sonal
    Edited by: 850979 on 13-Apr-2011 06:04

    Thanks for your reply.
    I have copied the .jar file in a new directory under <user name>/Documents. The SampleRTLCloud.txt is also in the same directory. How do I get the path of the directory where the application is run from?
    Your help will be much appreciated.
    Sonal

  • How to get the current path/directory

    Hey,
    I was wondering how to figure out the current path or directory where my Application is running (stored) in! I know there is a statement like getCodebase() for Applets to get the actual path, but I couldn't find anything similar for regular Applications. I think I can not just use a absolute path, since it might run on different os with different file seperator (like /root or c:\). Any help is welcome!
    Thank you very much,
    Marc

    Try this ...
            System.out.println("current directory = " + System.getProperty("user.dir"));
    [/code}                                                                                                                                                                                                                               

  • How do I get the full current path in the title bar of a terminal window?

    Is it possible to get the full current path in the title bar of a
    terminal window? I would find that more meaningful than
    "Terminal - tcsh - 80x60" (which I currently get). Doing
    this would free me from wanting to display the path in my
    system prompt thereby allowing me to use a shorter prompt
    and having more space on the line for actual input.
    Thanks
    Ron
    Dual 1Ghz PowerMac G4 Quicksilver 2002   Mac OS X (10.4.8)  

    IIRC, Terminal->Window Settings->Window controls that information. That said, I don't understand what full current path means in this context, nor why you'd want to display it in title bar.
    Your terminal prompt is a concatenation of your computer name (SysPrefs->Sharing—easily changed) and the path to your user's home directory using the short username (hard to change).
    computer name:~ username$

  • "Request Deallocation" breaks "Current Path" constant in LV8

    When a subVI includes the "request deallocation" block and the "current path" constant, and is called multiple times from another VI, only the first call will yield the subVI's path - subsequent calls return an empty path.  Attached is an example.  Note that the error only occurs when request deallocation is true.  This error is unique to LabVIEW 8.0... the same process under 7.1 worked fine.
    Attachments:
    RequestDeallocationError.llb ‏21 KB

    Hello,
    This problem has been reported to LabVIEW R&D.  For now, the workaround is to remove the Request Deallocation function, or set its input to False.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Getting the current path from which the form is runnig in 9i OAS

    Hi,
    We are using the built in Get_Application_property to get the
    current path in which the form is running. However this does not
    work in 9ioas and it only returns the form name and not the full
    path. Does anyone have any solutions to this problem?
    Thanks in Advance
    Jeet

    Place it in the classpath, then you can use ClassLoader#getResource().

  • UIX current path

    Hello,
    Does anybody know how to display the current path of the UIX page?
    I want to put this in a variable and send it to a dataAction so that after the execution in my dataAction has been done, I can fire back to the page I came from.
    I already tried ${pageContext.request.requestURI} only nothing comes out of this expression. Does anybody know the correct formulation of the binding to get the URI or path of the current UIX?
    Any help appreciated,
    Thanks,
    Gideon

    It works.. thanks.. only problem is that if I come from a DataPage, the URL/URI should end in a .do and not in a .uix
    With your example I only get .uix extensions.
    Is there a way to do this correctly.
    I have a datapage: workshops.do that forwards to an loginModule. One of the parameters of this loginModule is should be the correct URL. Because in this case I origin from a .do-page I also want this in the URL. Problem is that in the URL only .uix is displayed.
    Anybody know how to solve this?
    Thanks in advance,
    Gideon

  • Geting current path

    How can I get the current path that my java application is running???
    Thanks

    You likely shouldn't need to know that (if you think you do you're likely designing something incorrectly - but I know you'll just argue with me on that). But if you really must - System.getProperty("user.dir") returns it (I could be slightly off on the exact property name).

  • [b]Current path[/b] [b]navigation iview[/b].

    Hi¡¡¡
    Anyone knows how to retrieve programmatically the
    current path (the path of the opened resource) from a running navigation iview.I´m able to obtain the initial path only.
    Thnx.

    Hi Jon,
    Normally, this isn't possible if the original iView doesn't for example throws client side events (EPCF) or "publically" stores some information within the HttpSession.
    You can read the whole HttpSession object, if you are lucky and the nav iView implementation in fact stores such information somewhere within the session. But even if it does, it's nothing that's documented, so be careful, if you would find something like that, it might have gone in some upcoming release!
    Hope it helps
    Detlev

  • Possible to have a text field display current path of the pdf file?

    Would it be possible to display the current (windows) path of the pdf file in the page footer? Something we do in Word & AutoCAD... is it possible & how in Livecycle?
    thanks

    You can get the path of the current doc by using the command:
    event.target.path
    The filename can be retrieved by using:
    event.target.filename
    You can set these in a field on the master page so that it will appear as you want at bottom of every page.

  • How to get current path at runtime?

    i wish to determine file path at runtime.
    it will be run from an executable jar. i do not wish to do anything within the jar, i simply wish to know the full path that the jar was run from.
    how do i go about doing this?
    thanks.

    actually, after some testing, both of those methods returns where the call to run the jar was from, not where the jar itself resides.
    ie if you were at the dos prompt (with the current folder being C:\Current) and typed java -jar C:\AppFolder\test.jar as the command, it would return C:\Current vice C:\AppFolder where the jar was actually located.
    I want to return C:\AppFolder no matter where the call was from...

  • Current path

    i am running a program like
    "java tt.tt"
    tt 's directory is "c:/" (c:/tt/tt.class)
    and now i have a file in floder tt(that package)
    how can a get the current directory of that file ?

    you can attempt to get it via:
    public String getLocalPath() {
      URL url = getClass().getClassLoader().getResource(this.getClass().getName());
      return url.toString();
    }Calling getLocalPath() should return the full path, i.e. file://localhost/c:/tt/tt.class, that is, if the ClassLoader can locate the class. Sometimes I've had issues with the above method.
    A less finicky method is to use the command java -Dappdir="c:/tt" tt.tt , and then do the following in your code:
    public  String getLocalPath() {
      return System.getProperty("appdir");
    }The disadvantage here is that you need to change the -D property any time you move your class elsewhere.

  • Finding the current path

    Hey all,
    what is the shortest way to get the current directory?

    You can also call System.getProperty("user.dir"), which will return the user's current working directory as a String. Using "user.home" as the method parameter will give you the user's home directory. So if you want/need either of those directories, there's a simple 1-line way to obtain the values.
    -dSn

  • Imported Pictures are not showed in the current path

    Hello
    i am using elements organizer 10 to organize my pictures, about 100.000.
    All these pictures are in the location D:/pictures/privat pictures/2001/YYYYMMDD. Each year has a lot of folders oriented by date.
    All this pictures are a second time at my backup drive Z:/backup pictures/privat pictures/2001/................
    After creating a new catalog and start importing all files from D: it takes time till all pictures are imported.
    But then the failure happens if i click to any folder in D: i can not see any picture.
    If i start import i.e. for one single folder again i get the message" pictures are already imported..."
    If i click at  a bar in the timeline the pictures are shown and the path tree shows it at location Z....with the path name from D:
    I created more cataloges the last time to find a solution but nothing helps to fix this problem.
    I use Windows 7 ultimate
    Any idea?

    Your description suggests you are facing the folder view bug in versions before PSE11.
    - In that situation you have no 'missing files' but the files appear in the wrong folder in folder view. Everything seems normal in thumbnail view and you can't reimport files because they are already in the catalog.
    For the confusion for the drive letter, it would be useful if you could check the serial numbers of both of your drives.
    In Windows, open a DOS command 'Vol D:' and 'Vol Z:' and compare the results. Are D: and Z: two physically different drives or different logical partitions ?

Maybe you are looking for

  • How do I "Change country with this account" with a family share plan

    I have a family that is international. We have two accounts, one each in a different country! wife and I. Both accounts have many books, music apps and lots of iTunes credit still on account. . While trying to set up the new family plan, I keep getti

  • How to edit a post in Apple Support Comunities?

    If I just posted something and saw it had typos.   Is there any way to edit the post or remove it?  I have searched all over for an option to edit my post and see none.  I saw someone say that it was possible to edit within 15 minutes of making the p

  • Find custom oracle reports and forms

    Hi all, I would like to know the table names where I would be able to find all oracle forms and reports? Thanks in advance,

  • Include %@ include="content/home.html" %

    Anybody know why that line returns org.apache.jasper.compiler.ParseException: /eportal/index.jsp(18,0) Include directive: Mandatory attribute file missing I tested jsp with <% String blah = "IT worked"; out.print(blah); %> So at least that works... a

  • IOS 8 Safari Share Links Reorder Issue

    I have reordered the share links and extensions in Safari in IOS 8 so that my most used features/extensions are easily accessible. Every time I force close Safari or reboot my phone the order reverts back to default. Is anyone else experiencing this