Skip to content

Conversation

@akramcodez
Copy link

The tildeifyPath function incorrectly replaced paths starting with the home directory string but not actually subdirectories of it.

Before:

// Home: /home/akram
tildeifyPath('/home/akram-dev/file.txt') // Returns: '~/dev/file.txt' (wrong)

After:

// Home: /home/akram
tildeifyPath('/home/akram-dev/file.txt') // Returns: '/home/akram-dev/file.txt' (correct)

Changes

  • Check for exact home directory match first
  • Use path.sep for proper directory boundary detection
  • Only replace when path is actually under home directory

Testing

Verified with test scripts confirming the fix handles edge cases with similarly-named directories correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant