diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-11-15 17:21:38 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-11-15 17:21:38 +0100 |
| commit | 040c960a2788bef9910eee0a3c98cef7890f9d23 (patch) | |
| tree | 34aff3359befc7cba4c77056f8d38fb5286f3f92 /src | |
| parent | 6f7965d978081194b464faa8441db607998a1679 (diff) | |
| download | chawan-040c960a2788bef9910eee0a3c98cef7890f9d23.tar.gz | |
twtstr: beforeLast -> untilLast
for consistency
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.nim | 2 | ||||
| -rw-r--r-- | src/types/cookie.nim | 2 | ||||
| -rw-r--r-- | src/utils/twtstr.nim | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/main.nim b/src/main.nim index 17d49870..c183c01f 100644 --- a/src/main.nim +++ b/src/main.nim @@ -227,7 +227,7 @@ proc initConfig(ctx: ParamParseContext; config: Config; const libexecPath {.strdefine.} = "$CHA_BIN_DIR/../libexec/chawan" proc main() = - putEnv("CHA_BIN_DIR", getAppFileName().beforeLast('/')) + putEnv("CHA_BIN_DIR", getAppFileName().untilLast('/')) putEnv("CHA_LIBEXEC_DIR", ChaPath(libexecPath).unquoteGet()) let forkserver = newForkServer() let urandom = newPosixStream("/dev/urandom", O_RDONLY, 0) diff --git a/src/types/cookie.nim b/src/types/cookie.nim index 305af9fa..60355995 100644 --- a/src/types/cookie.nim +++ b/src/types/cookie.nim @@ -125,7 +125,7 @@ proc `$`*(cookiejar: CookieJar): string = # https://www.rfc-editor.org/rfc/rfc6265#section-5.1.4 func defaultCookiePath(url: URL): string = - let path = url.pathname.beforeLast('/') + let path = url.pathname.untilLast('/') if path == "" or path[0] != '/': return "/" return path diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index dd9d0871..9cb7e8e2 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -286,7 +286,7 @@ func afterLast*(s: string; c: set[char]; n = 1): string = func afterLast*(s: string; c: char; n = 1): string = s.afterLast({c}, n) -func beforeLast*(s: string; c: set[char]; n = 1): string = +func untilLast*(s: string; c: set[char]; n = 1): string = var j = 0 for i in countdown(s.high, 0): if s[i] in c: @@ -295,7 +295,7 @@ func beforeLast*(s: string; c: set[char]; n = 1): string = return s.substr(0, i) return s -func beforeLast*(s: string; c: char; n = 1): string = s.beforeLast({c}, n) +func untilLast*(s: string; c: char; n = 1): string = s.untilLast({c}, n) proc c_sprintf(buf, fm: cstring): cint {.header: "<stdio.h>", importc: "sprintf", varargs} |