Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
V
vitis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eugene 'Vindex' Stulin
vitis
Commits
0388e9dc
Commit
0388e9dc
authored
Feb 11, 2020
by
Eugene 'Vindex' Stulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes
parent
b360a285
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
source/module_assign.d
source/module_assign.d
+18
-17
No files found.
source/module_assign.d
View file @
0388e9dc
...
...
@@ -32,7 +32,7 @@ alias vpath = getVitisPath;
* Main function of the module
*/
void
mainFn
(
string
[]
args
)
{
string
err
=
"Wrong using of command 'assign'."
.
_s
;
auto
err
=
"Wrong using of command 'assign'."
.
_s
;
if
(
2
==
args
.
length
&&
args
[
1
].
among
(
"--help"
,
"-h"
))
{
moduleHelp
.
mainFn
(
"assign"
);
return
;
...
...
@@ -62,7 +62,7 @@ void mainFn(string[] args) {
return
;
}
bool
confOptionSave
=
(
VitisConf
.
getAutosave
==
"yes"
)
?
true
:
false
;
const
bool
confOptionSave
=
(
VitisConf
.
getAutosave
==
"yes"
)
;
string
destFileSpace
;
bool
cliOptionSave
=
false
;
getopt
(
args
,
config
.
passThrough
,
"save"
,
&
cliOptionSave
,
...
...
@@ -75,9 +75,9 @@ void mainFn(string[] args) {
//vitis assign [[-c] <category>] -f <file list>
string
[]
files
=
args
.
extractOptionRange
(
"-f"
);
if
(!
files
.
empty
&&
newName
.
empty
)
{
bool
autocategorization
=
VitisConf
.
getAutocategorization
!=
"none"
;
bool
positiveCondition1
=
categories
.
empty
&&
autocategorization
;
bool
positiveCondition2
=
!
categories
.
empty
;
const
autocategorization
=
VitisConf
.
getAutocategorization
!=
"none"
;
const
positiveCondition1
=
categories
.
empty
&&
autocategorization
;
const
positiveCondition2
=
!
categories
.
empty
;
checkCondition
!
err
(
positiveCondition1
||
positiveCondition2
);
foreach
(
f
;
files
)
{
if
(
f
.
exists
)
checkCondition
!
err
(!
f
.
isDir
);
...
...
@@ -133,7 +133,7 @@ void mainFn(string[] args) {
string
vitisFile
=
args
.
extractOptionValue
(
"-v"
);
if
(!
vitisFile
.
empty
)
checkCondition
!
err
(!
directoryOfFilePath
(
vitisFile
).
empty
);
auto
strNumber
=
args
.
extractOptionValue
(
"--number"
);
const
strNumber
=
args
.
extractOptionValue
(
"--number"
);
size_t
number
;
try
{
number
=
strNumber
.
empty
?
0
:
strNumber
.
to
!
size_t
;
...
...
@@ -185,8 +185,6 @@ void mainFn(string[] args) {
checkCondition
!
err
(!
newName
.
canFind
(
'/'
));
if
(!
vitisFile
.
empty
)
{
string
category
=
directoryOfFilePath
(
vitisFile
);
string
linkName
=
fileNameFromFilePath
(
vitisFile
);
checkCondition
!
err
(
args
.
length
==
1
);
assignNewNameToFileFromVitis
(
vitisFile
,
newName
,
number
);
return
;
...
...
@@ -267,13 +265,14 @@ void assignAliases(string category,
}
}
/**
*/
void
combineCategories
(
string
mainCategory
,
string
oldCategory
)
{
string
pathToOldCategory
=
getCatDirPath
(
oldCategory
);
string
[]
catDirList
=
amalthea
.
fs
.
getDirListRecurse
(
pathToOldCategory
);
catDirList
=
pathToOldCategory
~
catDirList
;
foreach
(
d
;
catDirList
)
{
string
currSubcategory
=
d
[
pathToOldCategory
.
length
..
$];
const
currSubcategory
=
d
[
pathToOldCategory
.
length
..
$];
string
oldSubcategory
=
oldCategory
~
"/"
~
currSubcategory
;
string
newSubcategory
=
mainCategory
~
"/"
~
currSubcategory
;
createNonExistentCategory
(
newSubcategory
,
true
,
false
);
...
...
@@ -662,7 +661,7 @@ private void createNewSymlinks(string[] categories,
}
//checking unnecessary links is not for autocategories
if
(
i
>
categories
.
length
-
1
||
categories
.
empty
)
continue
;
if
(
i
+
1
>
categories
.
length
||
categories
.
empty
)
continue
;
import
module_service
:
checkUnnecessaryLinks
;
auto
category
=
categories
[
i
];
...
...
@@ -686,6 +685,9 @@ private string[] getCategoriesPaths(string[] categories) {
return
categoriesPaths
;
}
/**
*/
bool
desktopFileIsLink
(
string
filepath
)
{
bool
result
;
try
{
...
...
@@ -817,8 +819,8 @@ private string addFileInFileSpace(string f,
}
else
{
cp
(
f
,
newLocation
);
}
}
else
if
(
f
.
isFile
&&
!
newLocation
.
isFile
||
f
.
isDir
&&
!
newLocation
.
isDir
)
{
}
else
if
(
(
f
.
isFile
&&
!
newLocation
.
isFile
)
||
(
f
.
isDir
&&
!
newLocation
.
isDir
)
)
{
"warning"
.
tprintln
(
newLocation
,
": "
,
s_
(
"Something is preventing the file from being added"
~
...
...
@@ -857,7 +859,7 @@ private string writeDuplicate(string file,
if
(
newFileName
.
empty
)
{
newFileName
=
baseName
(
file
);
}
string
repeatedBaseDir
=
dir
.
stripRight
(
'/'
)
~
"/__repeated_names/"
;
const
repeatedBaseDir
=
dir
.
stripRight
(
'/'
)
~
"/__repeated_names/"
;
string
fileLocation
;
for
(
size_t
i
=
2
;
;
i
++)
{
string
repDir
=
repeatedBaseDir
~
i
.
to
!
string
~
"/"
;
...
...
@@ -912,8 +914,7 @@ private bool createNonExistentCategory(string category,
);
return
false
;
}
string
categoryPath
=
getCatDirPath
(
category
);
if
(
categoryPath
!=
""
)
{
if
(
getCatDirPath
(
category
)
!=
""
)
{
return
true
;
}
if
(
userConfirmation
)
{
...
...
@@ -950,7 +951,7 @@ private string[] createNonExistentCategories(string[] categories,
private
string
saveLinkEntry
(
string
url
)
{
bool
HTML
=
amalthea
.
net
.
urlIs
HTML
(
url
);
const
bool
HTML
=
amalthea
.
net
.
isLinkTo
HTML
(
url
);
string
linkEntriesDir
=
HTML
?
getHTMLLinkEntriesPath
()
:
getNonHTMLLinkEntriesPath
();
string
tempEntryPath
;
// path to desktop-file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment