summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-30 14:21:42 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-30 14:21:42 -0500
commit5a7ca9106a305555922ef78c2dd84ab8779c7718 (patch)
treefe35f09c8ff1b0880196425333013a3526b4eed2 /main.c
parented8a56cc65411b8d00e4a8a9366855ea101f2e27 (diff)
fixed warnings on GCC, fixed opening an absolute path, README
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.c b/main.c
index 1709a97..8b68662 100644
--- a/main.c
+++ b/main.c
@@ -257,8 +257,11 @@ int main(int argc, char **argv) {
char path[TED_PATH_MAX];
if (starting_filename) {
// get full path to file
- strbuf_printf(path, "%s%s%s", ted->cwd, ted->cwd[strlen(ted->cwd) - 1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR,
- starting_filename);
+ if (!path_is_absolute(starting_filename))
+ strbuf_printf(path, "%s%s%s", ted->cwd, ted->cwd[strlen(ted->cwd) - 1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR,
+ starting_filename);
+ else
+ strbuf_printf(path, "%s", starting_filename);
} else {
strbuf_printf(path, "Untitled");
}