-
-
Notifications
You must be signed in to change notification settings - Fork 253
fix pwsh path error #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mikachu2333
wants to merge
7
commits into
RubyMetric:dev
Choose a base branch
from
Mikachu2333:feat/fix_win_pwsh_path
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix pwsh path error #250
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c957da4
fix pwsh path error
Mikachu2333 c4c927d
add version
Mikachu2333 ce149ee
use ifdef
Mikachu2333 0dd2c15
Merge branch 'dev' into feat/fix_win_pwsh_path
Mikachu2333 ac85c9d
use XY_On_Windows
Mikachu2333 2bd9970
fix build error
8e58c2e
fix build error
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# | Mikachu2333 <[email protected]> | ||
# | | ||
# Created On : <2025-06-19> | ||
# Last Modified : <2025-08-07> | ||
# Last Modified : <2025-08-11> | ||
# | ||
# Test PR | ||
# --------------------------------------------------------------- | ||
|
@@ -14,11 +14,12 @@ name: 测试PR | |
|
||
on: | ||
pull_request: | ||
types: [opened, | ||
synchronize, # 后续提交 | ||
ready_for_review, # draft PR 转为正式 PR | ||
review_requested, | ||
reopened] | ||
types: [ | ||
opened, | ||
ready_for_review, # draft PR 转为正式 PR | ||
review_requested, | ||
reopened, | ||
] | ||
paths: | ||
- "src/**" | ||
- "lib/**" | ||
|
@@ -50,6 +51,12 @@ jobs: | |
- name: 检出代码 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 创建测试文件 | ||
shell: powershell | ||
run: | | ||
New-Item -Path "$env:USERPROFILE\Documents\Powershell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force | ||
New-Item -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force | ||
|
||
- name: 安装依赖 | ||
run: | | ||
choco install just | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* | Mikachu2333 <[email protected]> | ||
* | | ||
* Created On : <2023-08-28> | ||
* Last Modified : <2025-08-09> | ||
* Last Modified : <2025-08-10> | ||
* | ||
* xy: 襄阳、咸阳 | ||
* Corss-Platform C11 utilities for CLI applications in mixed | ||
|
@@ -19,7 +19,7 @@ | |
#ifndef XY_H | ||
#define XY_H | ||
|
||
#define _XY_Version "v0.1.5.5-2025/08/09" | ||
#define _XY_Version "v0.1.5.5-2025/08/10" | ||
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" | ||
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" | ||
|
||
|
@@ -66,6 +66,7 @@ bool xy_enable_color = true; | |
#define xy_on_bsd false | ||
#define xy_os_devnull "nul" | ||
#include <windows.h> | ||
#include <shlobj.h> | ||
#define xy_useutf8() SetConsoleOutputCP (65001) | ||
|
||
#elif defined(__linux__) || defined(__linux) | ||
|
@@ -784,21 +785,55 @@ _xy_os_home () | |
return home; | ||
} | ||
|
||
|
||
static char * | ||
_xy_win_documents () | ||
{ | ||
#ifdef _WIN32 | ||
char documents_path[MAX_PATH]; | ||
HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL, | ||
SHGFP_TYPE_CURRENT, documents_path); | ||
|
||
if (SUCCEEDED (result)) | ||
return xy_strdup (documents_path); | ||
|
||
return xy_2strjoin (xy_os_home, "\\Documents"); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
#define xy_win_powershell_profile _xy_win_powershell_profile () | ||
#define xy_win_powershellv5_profile _xy_win_powershellv5_profile () | ||
|
||
// 更新 PowerShell 配置文件路径函数 | ||
static char * | ||
_xy_win_powershell_profile () | ||
{ | ||
return xy_2strjoin ( | ||
xy_os_home, "\\Documents\\PowerShell\\Microsoft.PowerShell_profile.ps1"); | ||
if (xy_on_windows) | ||
{ | ||
char *documents_dir = _xy_win_documents (); | ||
char *profile_path = xy_2strjoin (documents_dir, "\\PowerShell\\Microsoft.PowerShell_profile.ps1"); | ||
free (documents_dir); | ||
return profile_path; | ||
} | ||
else | ||
return NULL; | ||
} | ||
|
||
char * | ||
|
||
static char * | ||
_xy_win_powershellv5_profile () | ||
{ | ||
return xy_2strjoin ( | ||
xy_os_home, | ||
"\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); | ||
if (xy_on_windows) | ||
{ | ||
char *documents_dir = _xy_win_documents (); | ||
char *profile_path = xy_2strjoin (documents_dir, "\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); | ||
free (documents_dir); | ||
return profile_path; | ||
} | ||
else | ||
return NULL; | ||
} | ||
|
||
#define xy_zshrc "~/.zshrc" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
* SPDX-License-Identifier: MIT | ||
* ------------------------------------------------------------- | ||
* File Name : xy.c | ||
* File Authors : Aoran Zeng <[email protected]> | ||
* Contributors : Nil Null <[email protected]> | ||
* File Authors : Aoran Zeng <[email protected]> | ||
* Contributors : Nil Null <[email protected]> | ||
* | Mikachu2333 <[email protected]> | ||
* | | ||
* Created On : <2023-08-30> | ||
* Last Modified : <2025-08-08> | ||
* Last Modified : <2025-08-11> | ||
* | ||
* Test xy.h | ||
* ------------------------------------------------------------*/ | ||
|
@@ -97,6 +98,8 @@ main (int argc, char const *argv[]) | |
assert (xy_dir_exist ("~")); | ||
if (xy_on_windows) | ||
{ | ||
say (xy_win_powershell_profile); | ||
say (xy_win_powershellv5_profile); | ||
assert (xy_file_exist (xy_win_powershell_profile)); | ||
assert (true == xy_file_exist (xy_win_powershellv5_profile)); | ||
assert (xy_dir_exist ("C:\\Users")); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.