Skip to content

Commit 59a4089

Browse files
committed
Removed obsolete ComponentSource.json
1 parent c316bc1 commit 59a4089

4 files changed

Lines changed: 86 additions & 105 deletions

File tree

FindExecutable/ComponentSource.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

FindExecutable/FindExecutable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//
2626
// Version history:
2727
//
28-
// v1.0.2 -- 2026-03-31
28+
// v1.0.2 -- 2026-04-01
2929
// resolved further finding by code analyzer
3030
// v1.0.1 -- 2026-02-22
3131
// resolved findings by scanners

Program.cs

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
1-
//
2-
// Run Docker/Linux test with:
3-
//
4-
// docker build -t sgr/findexecutable .
5-
// docker run --rm sgr/findexecutable
6-
//
7-
8-
using System;
9-
using System.IO;
10-
using System.Reflection;
11-
12-
namespace FindExecutable
13-
{
14-
internal class Program
15-
{
16-
static int Main(string[] args)
1+
//
2+
// Run Docker/Linux test with:
3+
//
4+
// docker build -t sgr/findexecutable .
5+
// docker run --rm sgr/findexecutable
6+
//
7+
8+
using System;
9+
using System.IO;
10+
using System.Reflection;
11+
12+
namespace FindExecutable
13+
{
14+
internal class Program
15+
{
16+
static int Main(string[] args)
1717
{
18-
Console.OutputEncoding = System.Text.Encoding.UTF8;
19-
int retval = 0;
20-
21-
retval = Math.Max(retval, TestSearchGit());
22-
23-
retval = Math.Max(retval, TestUnicodeFile());
24-
25-
Console.WriteLine("done.");
18+
Console.OutputEncoding = System.Text.Encoding.UTF8;
19+
int retval = 0;
20+
21+
retval = Math.Max(retval, TestSearchGit());
22+
23+
retval = Math.Max(retval, TestUnicodeFile());
24+
25+
Console.WriteLine("done.");
2626
if (retval != 0)
2727
{
2828
Console.WriteLine($"exit code: {retval}");
29-
}
30-
return retval;
31-
}
32-
33-
static int TestSearchGit()
29+
}
30+
return retval;
31+
}
32+
33+
static int TestSearchGit()
3434
{
35-
string[] executables = [
36-
"git.exe",
37-
"git"
38-
];
39-
40-
foreach (string executable in executables)
41-
{
42-
try
43-
{
44-
Console.WriteLine($"Searching for: {executable}");
45-
46-
string? fullPath = FindExecutable.FullPath(executable);
47-
48-
if (fullPath != null)
49-
{
50-
if (Path.IsPathFullyQualified(fullPath))
51-
{
52-
Console.WriteLine($"FOUND: {fullPath}");
53-
}
54-
else
55-
{
56-
Console.WriteLine($"FOUND w/ WARNING: non-full path, {fullPath}");
57-
}
58-
}
59-
else
60-
{
61-
Console.Error.WriteLine("NOT FOUND");
62-
return 1;
63-
}
64-
}
65-
catch (Exception e)
66-
{
67-
Console.Error.WriteLine($"FAILED, Exception: {e}");
68-
return 2;
69-
}
70-
}
71-
35+
string[] executables = [
36+
"git.exe",
37+
"git"
38+
];
39+
40+
foreach (string executable in executables)
41+
{
42+
try
43+
{
44+
Console.WriteLine($"Searching for: {executable}");
45+
46+
string? fullPath = FindExecutable.FullPath(executable);
47+
48+
if (fullPath != null)
49+
{
50+
if (Path.IsPathFullyQualified(fullPath))
51+
{
52+
Console.WriteLine($"FOUND: {fullPath}");
53+
}
54+
else
55+
{
56+
Console.WriteLine($"FOUND w/ WARNING: non-full path, {fullPath}");
57+
}
58+
}
59+
else
60+
{
61+
Console.Error.WriteLine("NOT FOUND");
62+
return 1;
63+
}
64+
}
65+
catch (Exception e)
66+
{
67+
Console.Error.WriteLine($"FAILED, Exception: {e}");
68+
return 2;
69+
}
70+
}
71+
7272
return 0;
73-
}
74-
75-
static int TestUnicodeFile()
73+
}
74+
75+
static int TestUnicodeFile()
7676
{
7777
Console.WriteLine("Searching for an (artificial) executable with a unicode name:");
7878

7979
const string gitExec = "git";
80-
const string unicodeExec = "まじかよ。.exe";
81-
82-
if (File.Exists(unicodeExec))
83-
{
84-
File.Delete(unicodeExec);
85-
}
86-
80+
const string unicodeExec = "まじかよ。.exe";
81+
82+
if (File.Exists(unicodeExec))
83+
{
84+
File.Delete(unicodeExec);
85+
}
86+
8787
string unicodeExecPath = Path.Join(AppContext.BaseDirectory, unicodeExec);
8888
string? gitFullPath = FindExecutable.FullPath(gitExec);
8989

@@ -93,30 +93,30 @@ static int TestUnicodeFile()
9393
return 5;
9494
}
9595

96-
File.Copy(gitFullPath, unicodeExecPath);
97-
96+
File.Copy(gitFullPath, unicodeExecPath);
97+
9898
if (!OperatingSystem.IsWindows())
9999
{
100100
File.SetUnixFileMode(unicodeExecPath, File.GetUnixFileMode(gitFullPath));
101101
}
102102

103-
if (!FindExecutable.IsExecutable(unicodeExecPath))
103+
if (!FindExecutable.IsExecutable(unicodeExecPath))
104104
{
105105
Console.WriteLine($"Failed to setup the unicode executable file name: {unicodeExecPath}");
106106
return 3;
107-
}
107+
}
108108

109109
string? findIt = FindExecutable.FullPath(unicodeExec, includeCurrentDirectory: true);
110110
if (string.IsNullOrEmpty(findIt))
111111
{
112112
Console.WriteLine($"Failed to find the unicode executable file name: {unicodeExec}");
113113
return 4;
114-
}
114+
}
115115

116116
Console.WriteLine($"FOUND: {findIt}");
117117

118118
return 0;
119-
}
120-
121-
}
122-
}
119+
}
120+
121+
}
122+
}

SGrottel.FindExecutable.nuspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020

2121
<contentFiles>
2222
<files include="cs/any/FindExecutable/FindExecutable.cs" />
23-
<files include="cs/any/FindExecutable/ComponentSource.json" buildAction="None" />
2423
<files include="cs/any/FindExecutable/LICENSE" buildAction="None" />
2524
</contentFiles>
2625
</metadata>
2726

2827
<!-- content -->
2928
<files>
3029
<file src="FindExecutable\FindExecutable.cs" target="contentFiles/cs/any/FindExecutable" />
31-
<file src="FindExecutable\ComponentSource.json" target="contentFiles/cs/any/FindExecutable" />
3230
<file src="LICENSE" target="contentFiles/cs/any/FindExecutable/LICENSE" />
3331

3432
<file src="package_readme.md" target="docs/README.md" />

0 commit comments

Comments
 (0)