• 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. how to print the absolute/relative path from file

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 3947
  • 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

how to print the absolute/relative path from file

saurabh96
saurabh96 over 3 years ago

Hello I have two setting file....setting file 1 which consists of-

source netlist1                                                    (relative path)

top cell  test21

setting file 2 which consists of-

source /xyz/path1/path2/netlist1                       (absolute path)

top cell  test21

procedure(readSetupFile(form)
  let((prt split removeQuotes commandArg)
    setup_file_path = form->setupFile->value
    removeQuotes=pcreCompile("['\"]")
    unless(blankstrp(form->setupFile->value)
      prt=infile(form->setupFile->value)
      when(prt
        while(gets(line prt)
          split=parseString(line)
          when(stringp(cadr(split))
            commandArgs=pcreReplace(removeQuotes cadr(split) "" 0)
            case(car(split)
              (("source")
                test = parseString(setup_file_path "/")
                test_dir = append1((reverse (cdr (reverse test))) commandArgs)
                netpath = buildString(test_dir "/" )
                form->netlistPath->value = strcat("/" netpath)
              )
              ("topcell"
                form->cell->value=commandArgs
              )
            )
          )
        )
        close(prt)
      )
    )
  )
)

; dummy form to test
hiCreateLayoutForm(
  'forumForm
  "Forum example"
  hiCreateFormLayout(
    'vbox
    ?items list(
      hiCreateStringField(
        ?name 'setupFile
        ?prompt "Setup File"
        ?callback "readSetupFile(hiGetCurrentForm())"
      )
      hiCreateStringField(
        ?name 'netlistPath
        ?prompt "Netlist Path"
      )
      hiCreateStringField(
        ?name 'cell
        ?prompt "Cell"
      )
    )
  )
)

hiDisplayForm(forumForm)

when i give setting file1 path /xyz/abc/cadence/setting1 then output is comign correct as /xyz/abc/cadence/netlist1.

but when am giving setting file 2  path  /xyz/abc/cadence/setting1 then output is comign incorrect as /xyz/abc/cadence//xyz/path1/path2/netlist1 

how to correct so gets the corrrect result.

  • Cancel
Parents
  • AurelBuche
    AurelBuche over 3 years ago

    I guess what you are looking for is simplifyFilename

    This function takes a path in argument and gives you the fully expanded path

    If you give it your relative path, it will expand it in the current directory, if you give it the full path it will leave it as is

    Hope this help

    Cheers

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • AurelBuche
    AurelBuche over 3 years ago

    I guess what you are looking for is simplifyFilename

    This function takes a path in argument and gives you the fully expanded path

    If you give it your relative path, it will expand it in the current directory, if you give it the full path it will leave it as is

    Hope this help

    Cheers

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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