File tree 2 files changed +18
-4
lines changed
DaramRenamer.Commands/Commands/FilePath
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ namespace DaramRenamer.Commands.FilePath
7
7
[ Serializable , LocalizationKey ( "Command_Name_RelativeGoTo" ) ]
8
8
public class RelativeGoToCommand : ICommand
9
9
{
10
+ private const string CurrentDirectory = "." ;
11
+ private const string PreviousDirectory = ".." ;
12
+
10
13
public bool ParallelProcessable => true ;
11
14
public CommandCategory Category => CommandCategory . Path ;
12
15
@@ -15,7 +18,19 @@ public class RelativeGoToCommand : ICommand
15
18
16
19
public bool DoCommand ( FileInfo file )
17
20
{
18
- file . ChangedPath = System . IO . Path . Combine ( file . ChangedPath , Path ) ;
21
+ var temp = new List < string > ( System . IO . Path . Combine ( file . ChangedPath , Path ) . Split ( '/' , '\\ ' ) ) ;
22
+ temp . RemoveAll ( dir => dir == CurrentDirectory || string . IsNullOrEmpty ( dir ) ) ;
23
+
24
+ var indexOf = - 1 ;
25
+ while ( ( indexOf = temp . IndexOf ( PreviousDirectory ) ) >= 0 )
26
+ {
27
+ if ( indexOf == 0 || indexOf == 1 )
28
+ return false ;
29
+ temp . RemoveAt ( indexOf ) ;
30
+ temp . RemoveAt ( indexOf - 1 ) ;
31
+ }
32
+
33
+ file . ChangedPath = string . Join ( System . IO . Path . DirectorySeparatorChar , temp ) ;
19
34
return true ;
20
35
}
21
36
}
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
3
<OutputType >WinExe</OutputType >
4
- <TargetFramework >net5.0-windows</TargetFramework >
5
- <PublishTrimmed >true</PublishTrimmed >
4
+ <TargetFramework >net6.0-windows</TargetFramework >
6
5
<TrimMode >Link</TrimMode >
7
6
<UseWPF >true</UseWPF >
8
7
<RootNamespace >DaramRenamer</RootNamespace >
13
12
<ApplicationIcon >Resources\ProgramIcon.ico</ApplicationIcon >
14
13
<AssemblyName >DaramRenamer</AssemblyName >
15
14
<Copyright >Copyright ⓒ 2013-2021 Jin Jae-yeon</Copyright >
16
- <Version >2021.7.2 </Version >
15
+ <Version >2021.11.1 </Version >
17
16
<SignAssembly >true</SignAssembly >
18
17
<AssemblyOriginatorKeyFile >../Modules/StrongNameKey/Daelumgi.snk</AssemblyOriginatorKeyFile >
19
18
<ApplicationManifest >DaramRenamer.manifest</ApplicationManifest >
You can’t perform that action at this time.
0 commit comments