Repository navigation
Expand file tree
/
Copy pathasfileutils.cpp
More file actions
72 lines (61 loc) · 1.71 KB
/
Copy pathasfileutils.cpp
File metadata and controls
72 lines (61 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "asfileutils.h"
#include <QDir>
#include "../objects/asobject.h"
#include "../io/asnode.h"
#include "../resources/asresource.h"
AsFileUtils::AsFileUtils()
{
}
AsFileUtils::~AsFileUtils()
{
}
QString AsFileUtils::asGetObjectFilename( AsObject *pObject )
{
QString sSuffix = ".io";
AsObject::AsEnumObjectType type = pObject->asGetType();
switch ( type )
{
case AsObject::AS_OBJECT_ANNOTATIONRES:
case AsObject::AS_OBJECT_IMAGERES:
case AsObject::AS_OBJECT_LINERES:
case AsObject::AS_OBJECT_MOTIONRES:
case AsObject::AS_OBJECT_SHAPERES:
case AsObject::AS_OBJECT_TEXTRES:
case AsObject::AS_OBJECT_MEDIAFILERES:
{
sSuffix = ".ir";
}
break;
default:
//Do Nothing
break;
}
return QString::number( pObject->asGetID() ) + sSuffix;
}
QString AsFileUtils::asGetResourceDataFilename( AsResource *pResource )
{
QString sSuffix = "ird";
QString sOrig = pResource->asGetOriginalFilename();
if ( !sOrig.isEmpty() )
{
QFileInfo orig( sOrig );
if ( !orig.suffix().isEmpty() )
{
sSuffix = orig.suffix();
}
}
return QString::number( pResource->asGetID() ) + "." + sSuffix;
}
QString AsFileUtils::asGetNodeTreeFilename( AsNode *pNode )
{
return QString::number( pNode->asGetID() ) + ".in";
}
QString AsFileUtils::asCleanPath( const QString& path )
{
QString clean = QDir::cleanPath( path );
/** NN: this is to make sure that any paths stored in the '\' windows format are modified to the standard
'/' unix format */
clean.replace('\\', '/');
clean = QDir::toNativeSeparators( clean );
return clean;
}