microsoft / microsoft/PowerToys
Code quality: File paths (for settings)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 139k
- Forks
- 8.6k
- PR merge metrics
- PR metrics pending
Description
I see a few cases, similar to below. These are inconsistent, redundant and I think these can be improved by
1. leverage more "global" app constants, with a few specific names e.g. `UpdateFile`, `LanguageFile` etc.
1. direct syntax: at least use `Path.Combine`
A few existing examples:
```c#
// UpdateSettings.cs and LanguageModel.cs
// Non-localizable strings: Files
public const string SettingsFilePath = "\\Microsoft\\PowerToys\\";
public const string SettingsFile = "UpdateState.json";
...
var localAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var file = localAppDataDir + SettingsFilePath + SettingsFile;
```
```c#
// ModuleEnablementService
internal static string SettingsFilePath { get; } = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Microsoft",
"PowerToys",
"settings.json");
```
Besides that, it might be good to catch other improvements in specific files, when we encounter them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the examples in UpdateSettings.cs, LanguageModel.cs, and ModuleEnablementService. Search the repository for similar settings and file-path construction, then identify which cases fit the proposed consistency improvements. Done means the relevant paths use shared, specifically named constants where appropriate and avoid direct string concatenation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100