Skip to content

Commit 9ae113f

Browse files
authored
Adjusting device-listing build tool to support more options (#336)
1 parent 270f0e6 commit 9ae113f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

device-listing/Configuration.cs

+10
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,15 @@ internal class Configuration
2525
/// Gets or sets the list of languages to generate.
2626
/// </summary>
2727
public string[] Languages {get; set;}
28+
29+
/// <summary>
30+
/// Gets or sets the samples path.
31+
/// </summary>
32+
public string SamplesPath { get; set;}
33+
34+
/// <summary>
35+
/// Gets or sets whether to add or not README.md in the path to folder/link.
36+
/// </summary>
37+
public bool AddReadme { get; set; }
2838
}
2939
}

device-listing/Configuration.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,7 @@
107107
"Languages": [
108108
"",
109109
"zh-cn"
110-
]
110+
],
111+
"SamplesPath": "samples",
112+
"AddReadme": false
111113
}

device-listing/Program.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
return;
2626
}
2727

28-
string samplesPath = Path.Combine(repoRoot, "samples");
28+
string samplesPath = Path.Combine(repoRoot, configuration.SamplesPath);
2929
List<SampleInfo> samples;
3030

3131
// We will iterate one per language
@@ -133,7 +133,12 @@ string CreateMarkdownLinkFromPath(string path, string parentPath)
133133
throw new Exception($"No common path between `{path}` and `{parentPath}`");
134134
}
135135

136-
var relativePath = path.Substring(parentPath.Length + 1).Replace("\\README.md", "");
136+
var relativePath = path.Substring(parentPath.Length + 1);
137+
if (!configuration.AddReadme)
138+
{
139+
relativePath = relativePath.Replace("\\README.md", "");
140+
}
141+
137142
UriBuilder uriBuilder = new UriBuilder() { Path = relativePath };
138143

139144
return uriBuilder.Path;

0 commit comments

Comments
 (0)