From 701c3bb3c10e98862227272df2b312889afd95a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=97=B2=E8=80=98=E2=84=A2?= Date: Fri, 3 Feb 2023 14:44:00 +0800 Subject: [PATCH 1/2] fix: mkdir support dirname with whitespace in unix --- autoload/calendar.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/calendar.vim b/autoload/calendar.vim index 869e37a..0c677be 100644 --- a/autoload/calendar.vim +++ b/autoload/calendar.vim @@ -1062,7 +1062,7 @@ endfunction "***************************************************************** function! s:make_dir(dir) if(has("unix")) - call system("mkdir " . a:dir) + call system("mkdir \"" . a:dir . "\"") let rc = v:shell_error elseif(has("win16") || has("win32") || has("win95") || \has("dos16") || has("dos32") || has("os2")) From b2d10219906c9996ca073c3ce3af4233d582738a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=97=B2=E8=80=98=E2=84=A2?= Date: Thu, 9 Feb 2023 20:35:19 +0800 Subject: [PATCH 2/2] refact: use mkdir() when it's usable --- autoload/calendar.vim | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/autoload/calendar.vim b/autoload/calendar.vim index 0c677be..35d2c43 100644 --- a/autoload/calendar.vim +++ b/autoload/calendar.vim @@ -1061,12 +1061,13 @@ endfunction "* dir : directory "***************************************************************** function! s:make_dir(dir) - if(has("unix")) - call system("mkdir \"" . a:dir . "\"") - let rc = v:shell_error - elseif(has("win16") || has("win32") || has("win95") || - \has("dos16") || has("dos32") || has("os2")) - call system("mkdir \"" . a:dir . "\"") + if exists("*mkdir") + " mkdir() success return 1, else return 0 + let rc = !mkdir(a:dir, "p") + elseif has("unix") || + \has("win16") || has("win32") || has("win95") || + \has("dos16") || has("dos32") || has("os2") + call system("mkdir " . fnameescape(a:dir)) let rc = v:shell_error else let rc = 1