Relative-only paths
- Lingua principale
- C#
- Stelle
- 104
- Fork
- 15
- Merge medio
- 9m
- PR unite (30g)
- 2
Descrizione
Currently, we have the following two types for paths:
- `AbsolutePath` for, well, absolute paths,
- `LocalPath` for _any paths_.
We lack a separate type to specify a relative-only type, so let's get one. @PaGrom makes a good argument on its existence, see https://github.com/ForNeVeR/TruePath/issues/1#issuecomment-1113823321.
I propose the following design:
```csharp
struct RelativePath
{
public RelativePath(string path, bool trimLeadingSlash = false) { … }
}
```
Examples:
```csharp
new RelativePath("foo/bar") // => foo/bar
new RelativePath("/foo/bar", trimLeadingSlash = true) // => foo/bar
new RelativePath("/foo/bar"); // exception
```
Whether `trimLeadingSlash` should be `true` or `false` by default I am not sure. @PaGrom, what do you think? I would lean towards more strict behavior by default.
See `TODO[#23]` in the project sources when implementing this.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Individua TODO[#23] nei sorgenti del progetto ed esamina prima i tipi esistenti AbsolutePath e LocalPath. Definisci il comportamento di RelativePath in base agli esempi, incluso il rifiuto o la rimozione di una barra iniziale, e determina il valore predefinito non specificato per trimLeadingSlash. Il lavoro è completato quando il nuovo tipo impone esclusivamente percorsi relativi e si integra in modo coerente con i tipi di percorso esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- devtools
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100