Skip to content

Commit

Permalink
Merge branch 'main' into context_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
anovik committed Nov 8, 2023
2 parents 14b2334 + 5d69e9b commit c5d0fa7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
15 changes: 15 additions & 0 deletions src/SmartCommander/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ static internal class Utils
{
static internal void DeleteDirectoryWithHiddenFiles(string path)
{
if (!Directory.Exists(path))
{
return;
}
var directory = new DirectoryInfo(path) { Attributes = FileAttributes.Normal };

foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories))
Expand All @@ -15,5 +19,16 @@ static internal void DeleteDirectoryWithHiddenFiles(string path)

directory.Delete(true);
}

static internal void SetNormalFileAttributes(string path)
{
if (!File.Exists(path))
{
return;
}
FileInfo fileInfo = new FileInfo(path);
fileInfo.Attributes = FileAttributes.Normal;

}
}
}
6 changes: 5 additions & 1 deletion src/SmartCommander/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,11 @@ static void CopyDirectory(string sourceDir, string destinationDir, bool recursiv
foreach (FileInfo file in dir.GetFiles())
{
string targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
if (File.Exists(targetFilePath))
{
Utils.SetNormalFileAttributes(targetFilePath);
}
file.CopyTo(targetFilePath, true);
}

// If recursive and copying subdirectories, recursively call this method
Expand Down
16 changes: 7 additions & 9 deletions src/SmartCommander/Views/FilesPane.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
</TextBox>
<ComboBox Grid.Column="1" IsVisible="{Binding IsWindows}" Name="driveCombo" SelectedItem="{Binding SelectedDrive, Mode=TwoWay}">
</ComboBox>
</Grid>
<ScrollViewer Margin="5" Grid.Row="1">
<DataGrid IsTabStop="True"
</Grid>
<DataGrid Margin="5" Grid.Row="1" IsTabStop="True"
ItemsSource="{Binding FoldersFilesList}"
AutoGenerateColumns="False"
CanUserResizeColumns="True"
Expand Down Expand Up @@ -80,10 +79,10 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static assets:Resources.Name}" Binding="{Binding Name}"></DataGridTextColumn>
<DataGridTextColumn Header="{x:Static assets:Resources.Extension}" Binding="{Binding Extension}"></DataGridTextColumn>
<DataGridTextColumn Header="{x:Static assets:Resources.Size}" Binding="{Binding Size}"></DataGridTextColumn>
<DataGridTextColumn Header="{x:Static assets:Resources.Date}" Binding="{Binding DateCreated}"></DataGridTextColumn>
<DataGridTextColumn Width="2*" Header="{x:Static assets:Resources.Name}" Binding="{Binding Name}"></DataGridTextColumn>
<DataGridTextColumn Width="*" Header="{x:Static assets:Resources.Extension}" Binding="{Binding Extension}"></DataGridTextColumn>
<DataGridTextColumn Width="*" Header="{x:Static assets:Resources.Size}" Binding="{Binding Size}"></DataGridTextColumn>
<DataGridTextColumn Width="*" Header="{x:Static assets:Resources.Date}" Binding="{Binding DateCreated}"></DataGridTextColumn>
</DataGrid.Columns>

<i:Interaction.Behaviors>
Expand All @@ -103,8 +102,7 @@
<ia:CallMethodAction TargetObject="{Binding}" MethodName="SelectionChanged"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</DataGrid>
</ScrollViewer>
</DataGrid>
<TextBlock Grid.Row="2" Text="{Binding CurrentDirectoryInfo}"></TextBlock>
</Grid>
</UserControl>

0 comments on commit c5d0fa7

Please sign in to comment.