From 927b5a6c99719ddb9bc28adb446ecf006663b2c7 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 5 Sep 2020 14:58:12 +0800 Subject: [PATCH] fix a bug in Windows platform that the GetCurrentPath function use error function. --- src/Win/File.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Win/File.cpp b/src/Win/File.cpp index f6b7c97..0f26610 100644 --- a/src/Win/File.cpp +++ b/src/Win/File.cpp @@ -197,16 +197,16 @@ namespace hgl if(len==0) return false; - dir=new u16char[len+1]; + dir=new u16char[len]; //不用+1 if(GetCurrentDirectoryW(len,dir)) { if(len==3&&dir[1]==OS_TEXT(':')) len=2; //如果是"C:\"这种情况,去掉"\" - dir[len]=0; + dir[len-1]=0; - path.Set(dir,len,true); + path.SetInstance(dir,len-1); return(true); }