File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/Files.App/Services/Windows Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright (c) 2024 Files Community
2
2
// Licensed under the MIT License. See the LICENSE.
3
3
4
+ using System . IO ;
5
+
4
6
namespace Files . App . Services
5
7
{
6
8
/// <inheritdoc cref="IWindowsIniService"/>
@@ -9,19 +11,18 @@ public sealed class WindowsIniService : IWindowsIniService
9
11
/// <inheritdoc/>
10
12
public List < IniSectionDataItem > GetData ( string filePath )
11
13
{
12
- var iniPath = SystemIO . Path . Combine ( filePath ) ;
13
- if ( ! SystemIO . File . Exists ( iniPath ) )
14
+ if ( ! File . Exists ( filePath ) )
14
15
return [ ] ;
15
16
16
17
var lines = Enumerable . Empty < string > ( ) . ToList ( ) ;
17
18
18
19
try
19
20
{
20
- lines = SystemIO . File . ReadLines ( iniPath )
21
+ lines = File . ReadLines ( filePath )
21
22
. Where ( line => ! line . StartsWith ( ';' ) && ! string . IsNullOrEmpty ( line ) )
22
23
. ToList ( ) ;
23
24
}
24
- catch ( UnauthorizedAccessException )
25
+ catch ( Exception ex ) when ( ex is UnauthorizedAccessException || ex is FileNotFoundException )
25
26
{
26
27
return [ ] ;
27
28
}
You can’t perform that action at this time.
0 commit comments