• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Not getting correct path while using browse button to select...

Stats

  • Locked Locked
  • Replies 15
  • Subscribers 143
  • Views 14645
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not getting correct path while using browse button to select directory

saurabh96
saurabh96 over 3 years ago

Hello,

I have made a script to browse directory...but when am selecting the directory ,its creating wrong path to directory 

path_label=hiCreateLabel(
?name 'path_label ?labelText "Path*"
?justification 'left)

path_enter=hiCreateStringField(
?name 'path_enter
?defValue "/pkg/abc/xyz"
)

browse_Entry=hiCreateButton(
?name 'browse_Entry
?buttonText "Browse..."
?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"*\" 'directoryOnly)"
)

When am selecting directory /pkg/abc/efg its giving /pkg/.nh/05/efg...that path to directory is wrong and doesn't exist.

IS THERE A WAY WHEN I SELECT ANY DIRECOTRY THROUGH BROWSE OPTION i.e /pkg/abc/klj/ then in text box it automatically comes as realpath of /pkg/abc/klj of this directory?

to avoid above path error

regards,

thomas

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    If I've understood you correctly, the issue is that the symbolic links are being expanded when you pick "Choose" on the form (that's what happens for me). I can't see any way it would end up with a path that doesn't exist (unless you have a symbolic link to a path that doesn't exist). Anyway, there was a request a few years ago to not simplify the filename, and there were a bunch of fixes but it appears there's a remaining small issue in the final callback where the path still gets simplified. I've filed CCR 2593053 for that. There's no workaround at the moment. The path should not be incorrect - it's just been resolved - so I don't understand what you're saying above. Please take this up with customer support as somebody will need to see your environment to understand this.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Hello Andrew,

    Is there a way to browse a directory path that contains soft-link in it.

    Suppose there is a directory- thomas and his full path to directory is /pkg/xyz/thomas

    And if i do realpath /pkg/xyz/thomas then it is /pkg/.link/elpase/xyz/thomas ..so is there way to directly put realpath of directory of the directory selected in the textbox.

    Regards,

    thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    I don't understand. You've now asked for the complete opposite of what you asked for in the first place. Right now if you enter /pkg/xyz/thomas, it expands the links to /pkg/.link/elpase/xyz/thomas and shows that (the "realpath"). Earlier you said you didn't want that, but in the latest append you seem to be saying you do want that. So which is it?

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Hello Andrew,

    Sorry for confusion

    let me start again...

    so i have a path to directory say /pkg/xyz/abc/thomas 

    Now when i do realpath /pkg/xyz/abc/thomas in my shell window it expands to /pkg/.link/elpase/xyz/abc/thomas

    Now issue is when i browse directory and go one step down /pkg/xyz/abc/ and select any other directory andrew---> /pkg/xyz/abc/andrew

    now isue is that when i do realpath /pkg/xyz/abc/andrew in my shell window it expands to /pkg/.link/sunset/xyz/abc/thomas while in gui text box its showing /pkg/.link/elpase/xyz/abc/andrew which is wrong path.

    So, what the issue and how can i correct it.

    Hope it clears some clouds.

    Regards,

    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    Thomas,

    It's really not clear. Please contact customer support. As I said, the CCR I've filed is to request that the symbolic links are not expanded when the final return by ddsFileBrowseCB is performed. Maybe that will solve your problem, but I don't think there are any controls over this right now - any change in behaviour will need an enhancement request, so fully understanding precisely what is going on and feeding that into R&D requires you to log a case with support.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Ok, Andrew

    Thanks for guiding..will look into that

    Now,suppose when i browse directory it will give full path to directory thomas in below text box

    How can i delete directories i.e xyz/abc  that when user selects thomas directory from browse button only /pkg/thomas comes...anything between them(directories) automatically gets deleted 

    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    This is a bit odd, but I guess you could just have a callback on the string field take care of this?

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Andrew, path value is not fixed its depend on the different directory selected from browse button.

    Here is the script i have used-

    path_label=hiCreateLabel(
    ?name 'path_label ?labelText "Path"
    ?justification 'left)

    path_enter=hiCreateStringField(
    ?name 'path_enter
    )

    browse_Entry=hiCreateButton(
    ?name 'browse_Entry
    ?buttonText "Browse..."
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"\" 'directoryOnly)"
    )

    Now when i browse and select directory "test" from browse button i will get /pkg/check/halo/test in string field.

    I want that in string field only /pkg/test appears , or the absolute path should get trimmed..for any directory is been selected.

    My query is how can i do that trim part?

    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    I still think this is a peculiar model, but the solution is exactly as I described earlier - use a callback on the path_enter field:

    procedure(MyTrimPathCB(form)
      ; this is to stop it keep trimming in a loop - it uses a semaphore
      ; to determine whether we're already inside the callback
      unless(boundp('MyInCallback) && MyInCallback
        let((pat (MyInCallback t))
          pat=pcreCompile("/[^/]*/[^/]*$")
          form->path_enter->value=pcreReplace(pat form->path_enter->value "" 1)
        )
      )
    )
    
    
    path_label=hiCreateLabel( 
    ?name 'path_label ?labelText "Path"
    ?justification 'left)
    
    path_enter=hiCreateStringField(
    ?name 'path_enter
    ?callback "MyTrimPathCB(hiGetCurrentForm())"
    )
    
    browse_Entry=hiCreateButton(
    ?name 'browse_Entry
    ?buttonText "Browse..."
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"\" 'directoryOnly)" 
    )
    
    hiCreateLayoutForm(
      'myform
      "Forum test"
      hiCreateFormLayout(
        'lay
        ?items list(path_label path_enter browse_Entry)
      )
    )
    hiDisplayForm(myform)

    By the way, the CCR I filed earlier (to not expand symbolic links) has been fixed quickly by R&D, and will be in the IC6.1.8/ICADVM20.1 ISR24 version due out towards the end of March.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Hello Andrew,

    i tested the above script.

    actually its deleting the last two directory of the path.

    for eg- if path selected is /pkg/power/test/check/thomas then output coming  is /pkg/power/test/  

    i want that it should delete the directories in between them...expected output should be -->  /pkg/check/thomas

    Regards,

    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    Given that your explanation of what you wanted was really unclear, I just focused on illustrating how a callback could be used to change the path, not the precise details of what you wanted (since I didn't know that - you just gave one example of the starting path and what the result would be and no indication of the relationship between the code). I'm not writing your code for you - the point is that you can do whatever string substitution you want in the callback, and you can adapt the idea to whatever you need.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to saurabh96

    Hello Andrew,

    i have tried this way -

    path_label=hiCreateLabel(
    ?name 'path_label ?labelText "Path"
    ?justification 'left)

    path_enter=hiCreateStringField(
    ?name 'path_enter
    ?defValue "/pkg/power/test/check/thomas"
    ?callback "MyTrimPathCB(hiGetCurrentForm())"
    )

    browse_Entry=hiCreateButton(
    ?name 'browse_nxperc_Entry
    ?buttonText "Browse..."
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"\" 'directoryOnly)"
    )

    procedure(MyTrimPathCB(form)unless(boundp('MyInCallback) && MyInCallback
    let((pat (MyInCallback t))
    pat=pcreCompile("/[^/]*/[^/]*/[^/]*/[^/]*")
    form->path_enter->value=strcat("/pkg" pcreReplace(pat form->path_enter->value "" 1)

    although from above test script am getting output as /pkg/check/thomas but /pkg is popping in spite when i want field to be empty...

    So , my question is there a way i press browse button then only above string manipulation's should be done otherwise not?

    Regards,
    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • saurabh96
    saurabh96 over 3 years ago in reply to saurabh96

    Hello Andrew,

    i have tried this way -

    path_label=hiCreateLabel(
    ?name 'path_label ?labelText "Path"
    ?justification 'left)

    path_enter=hiCreateStringField(
    ?name 'path_enter
    ?defValue "/pkg/power/test/check/thomas"
    ?callback "MyTrimPathCB(hiGetCurrentForm())"
    )

    browse_Entry=hiCreateButton(
    ?name 'browse_nxperc_Entry
    ?buttonText "Browse..."
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"\" 'directoryOnly)"
    )

    procedure(MyTrimPathCB(form)unless(boundp('MyInCallback) && MyInCallback
    let((pat (MyInCallback t))
    pat=pcreCompile("/[^/]*/[^/]*/[^/]*/[^/]*")
    form->path_enter->value=strcat("/pkg" pcreReplace(pat form->path_enter->value "" 1)

    although from above test script am getting output as /pkg/check/thomas but /pkg is popping in spite when i want field to be empty...

    So , my question is there a way i press browse button then only above string manipulation's should be done otherwise not?

    Regards,
    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    The code above doesn't work because the MyTrimPathCB procedure is scrambled (the unless has no space after the close bracket) and has missing close parentheses, but other than that I think I understand what you're saying (the use model is very odd, so I'm having to guess a bit). You don't want the callback firing if you type in the field, but only if you use the browse button?

    If so, you'll have to use something other than ddsFileBrowseCB for the file browser because the callback which updates the path_enter field is built-in and you can't get it to do additional actions. Calling something after the ddsFileBrowseCB won't help because it is non-blocking and returns immediately. The option would be to launch a file browser yourself using hiDisplayFileDIalog and have a callback for that which does the trimming of the path and updating of the field.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Hello Andrew,
    exactly ....above seen is happening ...i don't want callback to be fired i.e.("/pkg") if i type other things in field or if i want field to be empty.

    Andrew, for removing the starting characters or path am using 

    pat=pcreCompile("/[^/]*/[^/]*/[^/]*/[^/]*")

    and for removing back characters we use 

    pat=pcreCompile("/[^/]*/[^/]*$")

    Suppose if i have to remove character's in between … then how should i modify the above line...for eg-
    in "/pkg/thomas/test/cadence/virtuoso/andrew"
    i want only "/pkg/thomas/virtuoso/andrew" how i can get that?

    also can you help me with an example for hiDisplayFileDIalog or any link where i get to understand how to use.

    Thanks in advance,

    regards,

    thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to saurabh96

    Any help/suggestion for above doubts?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information