Skip to content

Commit b130650

Browse files
committed
Update work locator to only use forward slashes, no backslashes. Updated documentation to mention that
1 parent c096a8d commit b130650

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ Below is a list of the required and optional propeties for the Update Options JS
145145
"updatePathOptions": {
146146
"rootDirectory": "./",
147147
"ignorePatterns": [
148-
"/samples/",
149-
"\\samples\\"
148+
"/samples/"
150149
]
151150
},
152151
"loggingOptions": {
@@ -196,21 +195,20 @@ Below is a list of the required and optional propeties for the Update Options JS
196195

197196
## Ignore Patterns
198197

199-
The Code Updater application has a default set of paths to ignore. The list is below. Note that all paths are in the list using both forwardslashes and backslashes. These are in addition to any skip paths passed in with the `IgnorePatterns` config file property. There is no way to remove these. Think of these like an ignore file, but no wildcard syntax. it's just basic string matching.
198+
The Code Updater application has a default set of paths to ignore. The list is below. Note that all paths are in the list using forwardslashes, which work on all platforms (Windows/Mac/Linux). These are in addition to any skip paths passed in with the `IgnorePatterns` config file property. There is no way to remove these. Think of these like an ignore file, but no wildcard syntax. It's just basic string matching.
200199

201200
Ignore all C# `obj` and `bin` folders:
202201
- /obj/Debug/
203202
- /obj/Release/
204203
- /bin/Debug/
205204
- /bin/Release/
206-
- \obj\Debug\
207-
- \obj\Release\
208-
- \bin\Debug\
209-
- \bin\Release\
210205

211206
Ignore packages inside node_modules folder:
212207
- /node_modules/
213-
- \node_modules\
208+
209+
Ignore some other app specific folders
210+
- /.git/
211+
- /.vs/
214212

215213
## Installing Locally vs Downloading the Code
216214

src/CodeUpdater/CodeUpdater/Options/CommandOptions.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Collections.Immutable;
4-
using System.Diagnostics.CodeAnalysis;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
9-
using CommandLine;
1+
using CommandLine;
102

113
namespace ProgrammerAL.Tools.CodeUpdater.Options;
124
public class CommandOptions

src/CodeUpdater/CodeUpdater/WorkLocator.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ private ImmutableArray<string> DetermineValidDirectories(string rootDirectory)
2828

2929
//Get all directories, including subdirectories
3030
// Make sure the directory path string includes a trailing slash so we can compare it to the skip paths
31+
// Replace backslashes with forward slashes so we can compare them to the skip paths
3132
var allDirectories = Directory.GetDirectories(rootDirectory, "*", SearchOption.AllDirectories)
32-
.Select(x => $"{x}{Path.DirectorySeparatorChar}");
33+
.Select(x => $"{x}/".Replace('\\', '/'));
3334
var validDirectories = new List<string>();
3435

3536
foreach (var directoryPath in allDirectories)
@@ -104,6 +105,7 @@ public ImmutableArray<string> FindNpmDirectories(ImmutableArray<string> validDir
104105

105106
private ImmutableArray<string> DetermineSkipPaths(IEnumerable<string> additionalSkipPaths)
106107
{
108+
//Only use forward slashes for paths, even on Windows. They work everywhere, even on Windows.
107109
var skipPaths = new[]
108110
{
109111
//Ignore all obj and bin folders
@@ -117,16 +119,14 @@ private ImmutableArray<string> DetermineSkipPaths(IEnumerable<string> additional
117119
//Ignore packages inside node_modules
118120
@"/node_modules/",
119121

120-
//Ignore the .git folder
122+
//Ignore some other app specific folders
121123
@"/.git/",
122124
@"/.vs/",
123125
}
124126
.ToImmutableArray();
125127

126-
//Include the same paths, but with backslashes so this is cross-platform
127-
skipPaths = skipPaths.AddRange(skipPaths.Select(x => x.Replace("/", "\\")));
128-
129-
skipPaths = skipPaths.AddRange(additionalSkipPaths);
128+
var normalizedAdditionalPaths = additionalSkipPaths.Select(x => x.Replace('\\', '/'));
129+
skipPaths = skipPaths.AddRange(normalizedAdditionalPaths);
130130

131131
return skipPaths;
132132
}

0 commit comments

Comments
 (0)