Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
epoc-editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
learninglab
epoc
epoc-editor
Commits
8b65689b
Commit
8b65689b
authored
1 year ago
by
VIAUD Nathan
Browse files
Options
Downloads
Patches
Plain Diff
fix: saving returns errors
parent
9f446bc3
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!117
Resolve "saving without the icons folder returns an error"
Pipeline
#948899
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
electron/components/file.js
+15
-6
15 additions, 6 deletions
electron/components/file.js
with
15 additions
and
6 deletions
electron/components/file.js
+
15
−
6
View file @
8b65689b
...
@@ -317,12 +317,15 @@ const getAllAssets = function (workdir) {
...
@@ -317,12 +317,15 @@ const getAllAssets = function (workdir) {
if
(
stat
.
isFile
())
assetPaths
.
push
(
itemPath
);
if
(
stat
.
isFile
())
assetPaths
.
push
(
itemPath
);
}
}
const
iconItems
=
fs
.
readdirSync
(
iconsPath
);
// return if icons folder does not exist
for
(
const
item
of
iconItems
)
{
if
(
fs
.
existsSync
(
iconsPath
))
{
const
itemPath
=
path
.
join
(
iconsPath
,
item
);
const
iconItems
=
fs
.
readdirSync
(
iconsPath
);
const
stat
=
fs
.
statSync
(
itemPath
);
for
(
const
item
of
iconItems
)
{
const
itemPath
=
path
.
join
(
iconsPath
,
item
);
if
(
stat
.
isFile
())
assetPaths
.
push
(
itemPath
);
const
stat
=
fs
.
statSync
(
itemPath
);
if
(
stat
.
isFile
())
assetPaths
.
push
(
itemPath
);
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
'
Error reading assets directory
'
,
e
);
console
.
error
(
'
Error reading assets directory
'
,
e
);
...
@@ -340,6 +343,8 @@ const getAllAssets = function (workdir) {
...
@@ -340,6 +343,8 @@ const getAllAssets = function (workdir) {
};
};
const
getUsedAssets
=
function
(
workdir
)
{
const
getUsedAssets
=
function
(
workdir
)
{
// if(!fs.existsSync(path.join(workdir, 'project.json'))) return [];
const
projectJSON
=
fs
.
readFileSync
(
path
.
join
(
workdir
,
'
project.json
'
),
'
utf8
'
);
const
projectJSON
=
fs
.
readFileSync
(
path
.
join
(
workdir
,
'
project.json
'
),
'
utf8
'
);
const
regex
=
/"assets
[\\/\\\\]([^
"
]
+
)
"/g
;
const
regex
=
/"assets
[\\/\\\\]([^
"
]
+
)
"/g
;
const
matches
=
projectJSON
.
match
(
regex
);
const
matches
=
projectJSON
.
match
(
regex
);
...
@@ -357,7 +362,11 @@ const getUsedAssets = function (workdir) {
...
@@ -357,7 +362,11 @@ const getUsedAssets = function (workdir) {
});
});
};
};
// TODO: Add a parameter to see if exporting or not to get data from content.json instead of project.json
const
getUnusedAssets
=
function
(
workdir
)
{
const
getUnusedAssets
=
function
(
workdir
)
{
//? On first save this function is called before project.json is created
if
(
!
fs
.
existsSync
(
path
.
join
(
workdir
,
'
project.json
'
)))
return
[];
const
allAssets
=
getAllAssets
(
workdir
);
const
allAssets
=
getAllAssets
(
workdir
);
const
usedAssets
=
getUsedAssets
(
workdir
);
const
usedAssets
=
getUsedAssets
(
workdir
);
...
...
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