Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Synchronous variants to path functions #4288

Closed
ClementNerma opened this issue Jun 7, 2022 · 1 comment
Closed

[feat] Synchronous variants to path functions #4288

ClementNerma opened this issue Jun 7, 2022 · 1 comment

Comments

@ClementNerma
Copy link

Describe the problem

All dir functions in path (homeDir, configDir, etc.) are asynchronous. This is great as a default behaviour, but sometimes it's extremely inconvenient.

I'm currently building an app where I define the application's path based on the user's configuration directory and then use it in many different functions, including some synchronous ones. With the current library, this is completely impossible as getting the user's config. directory results in a Promise. So I'm forced to make all these functions asynchronous just because of that.

// This is a Promise<string>, I'd like a string.
export const DATA_DIR = path
  .configDir()
  .then((configDir) => path.join(configDir, 'Writer'))

Describe the solution you'd like

Would it be possible to make synchronous counterparts of these methods? This would be quite useful in this scenario, and fetching these directory's path is extremely fast so it wouldn't make the app unresponsive.

Alternatives considered

No response

Additional context

No response

@amrbashir
Copy link
Member

this is not possible currently due to some limitation, subscribe to tauri-apps/wry#454 for when it is resolved.

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

No branches or pull requests

2 participants