mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-02 06:54:01 +08:00
Make windows recognize ~
This commit is contained in:
parent
f65793c1db
commit
720f011c6e
2
chsrc.c
2
chsrc.c
|
@ -295,7 +295,7 @@ pl_php_setsrc (char* option)
|
||||||
void
|
void
|
||||||
pl_lua_getsrc (char* option)
|
pl_lua_getsrc (char* option)
|
||||||
{
|
{
|
||||||
chsrc_check_file (" ~/.luarocks/config.lua");
|
chsrc_check_file ("~/.luarocks/config.lua");
|
||||||
chsrc_check_file ("~/.luarocks/upload_config.lua");
|
chsrc_check_file ("~/.luarocks/upload_config.lua");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
chsrc.h
4
chsrc.h
|
@ -290,6 +290,10 @@ chsrc_check_file (const char* path)
|
||||||
{
|
{
|
||||||
char* cmd = NULL;
|
char* cmd = NULL;
|
||||||
if(xy_on_windows) {
|
if(xy_on_windows) {
|
||||||
|
if (xy_str_start_with(path, "~/")){
|
||||||
|
path = xy_2strjoin("%USERPROFILE%\\", xy_str_delete_prefix(path, "~/"));
|
||||||
|
path = xy_str_gsub(path, "/", "\\");
|
||||||
|
}
|
||||||
cmd = xy_2strjoin ("type ", path);
|
cmd = xy_2strjoin ("type ", path);
|
||||||
} else {
|
} else {
|
||||||
cmd = xy_2strjoin ("cat ", path);
|
cmd = xy_2strjoin ("cat ", path);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user