File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
crates/gitbutler-project/src Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,20 @@ impl Project {
121121 /// Finds an existing project by its path. Errors out if not found.
122122 pub fn find_by_path ( path : & Path ) -> anyhow:: Result < Project > {
123123 let projects = crate :: list ( ) ?;
124+ let resolved_path = if path. is_relative ( ) {
125+ path. canonicalize ( ) . context ( "Failed to canonicalize path" ) ?
126+ } else {
127+ path. to_path_buf ( )
128+ } ;
124129 let project = projects
125130 . into_iter ( )
126- . find ( |p| p. path == path)
131+ . find ( |p| {
132+ // Canonicalize project path for comparison
133+ match p. path . canonicalize ( ) {
134+ Ok ( proj_canon) => proj_canon == resolved_path,
135+ Err ( _) => false ,
136+ }
137+ } )
127138 . context ( "No project found with the given path" ) ?;
128139 Ok ( project)
129140 }
You can’t perform that action at this time.
0 commit comments