Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openxt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
openxt
Commits
fd9a7f7f
There was an error fetching the commit references. Please try again later.
Commit
fd9a7f7f
authored
3 years ago
by
Recolic K
Browse files
Options
Downloads
Patches
Plain Diff
add a global.json warning utility
parent
10b6d7a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.go
+1
-1
1 addition, 1 deletion
main.go
tools/csproj-to-5/main.go
+37
-1
37 additions, 1 deletion
tools/csproj-to-5/main.go
with
38 additions
and
2 deletions
main.go
+
1
−
1
View file @
fd9a7f7f
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
// Some options here. Would be improved in beta release.
// Some options here. Would be improved in beta release.
const
DEDUCT_PKGNAME_FROM_VARNAME
=
true
const
DEDUCT_PKGNAME_FROM_VARNAME
=
true
const
USE_PROJECT_NETVER_INSTEAD_OF_HINTPATH_NETVER
=
false
const
USE_PROJECT_NETVER_INSTEAD_OF_HINTPATH_NETVER
=
false
const
OPENXT_VERSION
=
"1.4.1-
1
"
const
OPENXT_VERSION
=
"1.4.1-
2
"
func
print_help_and_exit
()
{
func
print_help_and_exit
()
{
println
(
"Usage: openxt <subcommand> [options...]"
)
println
(
"Usage: openxt <subcommand> [options...]"
)
...
...
This diff is collapsed.
Click to expand it.
tools/csproj-to-5/main.go
+
37
−
1
View file @
fd9a7f7f
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"io/ioutil"
"log"
"log"
"os"
"os"
"path/filepath"
"strings"
"strings"
)
)
...
@@ -40,6 +41,39 @@ func stringReplaceOnceInsensitive(s, old, new string) string {
...
@@ -40,6 +41,39 @@ func stringReplaceOnceInsensitive(s, old, new string) string {
}
}
///////////////////////////// utils END
///////////////////////////// utils END
// Send a warning if there's any "global.json" existing in parent path.
// BeginPoint could be a filename, or a directory. However, the leaf entry would be discarded (skipped)!
//
// Example: If beginPoint is `./program/minecraft/hmcl.jar`, then I'll search `./program/minecraft/*`,
// `./program/*`, `./*`, `./../*`, ...
// If beginPoint is `./program/minecraft`, then I'll search `./program/*`, `./*`, `./../*` ...
func
warnGlobalJson
(
beginPoint
string
)
{
// Make it abs path.
if
!
filepath
.
IsAbs
(
beginPoint
)
{
wd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
return
}
beginPoint
=
filepath
.
Join
(
wd
,
beginPoint
)
}
// Iterate
currPath
:=
beginPoint
for
{
// Go to parent, and exit the loop if we're already on root (`/` or `C:\`).
par
:=
filepath
.
Dir
(
currPath
)
if
par
==
currPath
{
break
}
currPath
=
par
// Check if global.json exists in this level.
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
currPath
,
"global.json"
));
err
==
nil
{
println
(
"WARNING: Please consider remove "
+
currPath
+
string
(
os
.
PathSeparator
)
+
"global.json . It may cause problem to your dotnet. "
)
}
}
}
// This is a naive tool to convert CoreXT csproj file to dotnet 5 csproj file.
// This is a naive tool to convert CoreXT csproj file to dotnet 5 csproj file.
// It should work on 99% well-formatted csproj file.
// It should work on 99% well-formatted csproj file.
// |
// |
...
@@ -54,7 +88,9 @@ func main() {
...
@@ -54,7 +88,9 @@ func main() {
content
,
err
:=
ioutil
.
ReadFile
(
fname
)
content
,
err
:=
ioutil
.
ReadFile
(
fname
)
panicErrorIfAny
(
err
,
"read file "
+
fname
)
panicErrorIfAny
(
err
,
"read file "
+
fname
)
// Good luck for old MacOS! They use single \r as newline.
warnGlobalJson
(
fname
)
// May have problem here for old MacOS! They use single \r as newline.
lines
:=
strings
.
Split
(
strings
.
ReplaceAll
(
string
(
content
),
"
\r\n
"
,
"
\n
"
),
"
\n
"
)
lines
:=
strings
.
Split
(
strings
.
ReplaceAll
(
string
(
content
),
"
\r\n
"
,
"
\n
"
),
"
\n
"
)
resultTxt
:=
""
resultTxt
:=
""
removeEndOfTagInNextLine
:=
""
// Empty value indicates no need to remove EOT.
removeEndOfTagInNextLine
:=
""
// Empty value indicates no need to remove EOT.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment