• 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. equivalent skill function to the unix dirname command

Stats

  • Replies 2
  • Subscribers 148
  • Views 505
  • Members are here 0

equivalent skill function to the unix dirname command

kkdesbois
kkdesbois 1 month ago

Hello,

Is there an API that returns the directory path of a full path, like unix dirname command


I currently use this syntax
(buildString (reverse (cdr (reverse (parseString (simplifyFilename fileName) "/")))) "/")

Is there a more elegant way to do the same?

Laurent.

  • Cancel
  • Sign in to reply
Parents
  • Aurel B
    Aurel B 1 month ago

    Hi Laurent,

    I generally use : 

    (simplifyFilename (strcat path "/.."))

    Surprisingly it also works with file paths.

    Regards,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Aurel B
    Aurel B 1 month ago

    Hi Laurent,

    I generally use : 

    (simplifyFilename (strcat path "/.."))

    Surprisingly it also works with file paths.

    Regards,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett 1 month ago in reply to Aurel B

    I've always tended to use regular expressions. Something like:

    baseNamePat=pcreCompile("[^/]*$") ; could add a "/" at the beginning if you don't want a trailing / in the dirName
    dirName=pcreReplace(baseNamePat originalPath "" 1)

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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.

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

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