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

v2 requiring an instance of App, AppHandle or Window to get access to path functions like home_dir() #10478

Open
zoaha opened this issue Aug 4, 2024 · 12 comments
Labels
help wanted Help is requested to fix this issue type: documentation Need to update the API documentation

Comments

@zoaha
Copy link

zoaha commented Aug 4, 2024

in v1, all you needed was to import and you had access to paths:

use tauri::api::path::home_dir;

#[tauri::command]
fn getPath() -> Result<PathBuf> {
   home_dir()

but now in v2, you need an instance of AppHandle:

use tauri::Manager;

#[tauri::command]
fn getPath(app: tauri::AppHandle) -> Result<PathBuf> {
   app.path().home_dir()

is this intended?
also there's no documentation I could find on v2 usage of paths

@chippers
Copy link
Member

chippers commented Aug 5, 2024

It is intended, but I think documentation is a good answer to it.

Thanks for filing :)

@chippers chippers added type: documentation Need to update the API documentation help wanted Help is requested to fix this issue labels Aug 5, 2024
@Grandkahuna43325

This comment was marked as off-topic.

@amrbashir

This comment was marked as off-topic.

@Grandkahuna43325

This comment was marked as off-topic.

@amrbashir

This comment was marked as off-topic.

@Grandkahuna43325

This comment was marked as off-topic.

@amrbashir

This comment was marked as off-topic.

@Grandkahuna43325

This comment was marked as off-topic.

@amrbashir

This comment was marked as off-topic.

@Grandkahuna43325

This comment was marked as off-topic.

@amrbashir

This comment was marked as off-topic.

@Grandkahuna43325

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Help is requested to fix this issue type: documentation Need to update the API documentation
Projects
None yet
Development

No branches or pull requests

4 participants