Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
2a2d5669
Commit
2a2d5669
authored
Jun 21, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error on remplacing
file:///
depending on system os
parent
b85adf85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
18 deletions
+29
-18
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+9
-13
UBW3CWidget.cpp
src/domain/UBW3CWidget.cpp
+2
-5
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+16
-0
UBFileSystemUtils.h
src/frameworks/UBFileSystemUtils.h
+2
-0
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
2a2d5669
...
...
@@ -1806,12 +1806,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsAud
}
QString
audioFileHref
=
audioItem
->
mediaFileUrl
().
toString
();
//on windows
if
(
audioFileHref
.
startsWith
(
"file:///"
))
audioFileHref
=
audioFileHref
.
replace
(
"file:///"
+
mDocumentPath
+
"/"
,
""
);
//mac and linux
if
(
audioFileHref
.
startsWith
(
"file://"
))
audioFileHref
=
audioFileHref
.
replace
(
"file://"
+
mDocumentPath
+
"/"
,
""
);
audioFileHref
=
UBFileSystemUtils
::
removeLocalFilePrefix
(
audioFileHref
);
if
(
audioFileHref
.
startsWith
(
mDocumentPath
))
audioFileHref
=
audioFileHref
.
replace
(
mDocumentPath
+
"/"
,
""
);
mXmlWriter
.
writeAttribute
(
nsXLink
,
"href"
,
audioFileHref
);
mXmlWriter
.
writeEndElement
();
}
...
...
@@ -1837,13 +1835,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsVid
}
QString
videoFileHref
=
videoItem
->
mediaFileUrl
().
toString
();
//on windows
if
(
videoFileHref
.
startsWith
(
"file:///"
))
videoFileHref
=
videoFileHref
.
replace
(
"file:///"
+
mDocumentPath
+
"/"
,
""
);
//on mac and linux
if
(
videoFileHref
.
startsWith
(
"file://"
))
videoFileHref
=
videoFileHref
.
replace
(
"file://"
+
mDocumentPath
+
"/"
,
""
);
mXmlWriter
.
writeAttribute
(
nsXLink
,
"href"
,
videoFileHref
);
videoFileHref
=
UBFileSystemUtils
::
removeLocalFilePrefix
(
videoFileHref
);
if
(
videoFileHref
.
startsWith
(
mDocumentPath
))
videoFileHref
=
videoFileHref
.
replace
(
mDocumentPath
+
"/"
,
""
);
mXmlWriter
.
writeAttribute
(
nsXLink
,
"href"
,
videoFileHref
);
mXmlWriter
.
writeEndElement
();
}
...
...
src/domain/UBW3CWidget.cpp
View file @
2a2d5669
...
...
@@ -246,9 +246,7 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
const
QString
&
pName
)
{
QString
url
=
pUrl
;
// if the file name start with file:// it has be removed because QFileInfo doesn't support this form
url
=
url
.
replace
(
"file:///"
,
""
);
url
=
url
.
replace
(
"file://"
,
""
);
url
=
UBFileSystemUtils
::
removeLocalFilePrefix
(
url
);
QString
name
=
pName
;
QFileInfo
fi
(
url
);
...
...
@@ -305,8 +303,7 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
if
(
fi
.
exists
()){
QString
target
=
widgetLibraryPath
+
"/"
+
fi
.
fileName
();
QString
source
=
pUrl
;
source
=
source
.
replace
(
"file:///"
,
""
);
source
=
source
.
replace
(
"file://"
,
""
);
source
=
UBFileSystemUtils
::
removeLocalFilePrefix
(
source
);
QFile
::
copy
(
source
,
target
);
}
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
2a2d5669
...
...
@@ -39,6 +39,22 @@ UBFileSystemUtils::~UBFileSystemUtils()
// NOOP
}
QString
UBFileSystemUtils
::
removeLocalFilePrefix
(
QString
input
)
{
#ifdef Q_WS_WIN
if
(
input
.
startsWith
(
"file:///"
))
return
input
.
mid
(
8
);
else
return
input
;
#else
if
(
input
.
startsWith
(
"file://"
))
return
input
.
mid
(
7
);
else
return
input
;
#endif
}
bool
UBFileSystemUtils
::
isAZipFile
(
QString
&
filePath
)
{
if
(
QFileInfo
(
filePath
).
isDir
())
return
false
;
...
...
src/frameworks/UBFileSystemUtils.h
View file @
2a2d5669
...
...
@@ -28,6 +28,8 @@ class UBFileSystemUtils
UBFileSystemUtils
();
virtual
~
UBFileSystemUtils
();
static
QString
removeLocalFilePrefix
(
QString
input
);
static
QString
defaultTempDirName
()
{
return
QCoreApplication
::
applicationName
();
}
static
QString
defaultTempDirPath
();
static
QString
createTempDir
(
const
QString
&
templateString
=
defaultTempDirName
(),
bool
autoDeleteOnExit
=
true
);
...
...
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