File tree Expand file tree Collapse file tree 4 files changed +32
-11
lines changed Expand file tree Collapse file tree 4 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -1754,17 +1754,17 @@ <h3><a name="3dsExport">3D-Studio file:</a></h3>
1754
1754
scanned for unofficial parts.< br />
1755
1755
You can type in a path, or hit the < i > Browse...</ i > button. If you type in a
1756
1756
path that doesn't resolve to a zip file, you will get an error when you apply
1757
- your preferences changes.
1757
+ your preferences changes.< br />
1758
+ If you do not also specify an LDraw Folder, LDView will create an Unofficial
1759
+ directory alongside the zip file if Unofficial parts are automatically
1760
+ downloaded.
1758
1761
</ p >
1759
1762
< p >
1760
1763
< i > LDraw Folder</ i > < br />
1761
1764
This allows you to manually select the LDraw folder.< br />
1762
1765
You can type in a path, or hit the < i > Browse...</ i > button. If you type in a
1763
1766
path that isn't an LDraw folder, you will get an error when you apply your
1764
- preferences changes.< br />
1765
- Note that if you specify an LDraw Zip, the LDraw Folder is no longer required to
1766
- have parts and p subdirectories. It still must be valid, though, since that is
1767
- where automatically downloaded unofficial parts will be placed.
1767
+ preferences changes.
1768
1768
</ p >
1769
1769
< p >
1770
1770
< i > < a name ="ExtraDirs "> Extra Search Folders/Directories</ a > </ i > < br />
Original file line number Diff line number Diff line change @@ -4046,8 +4046,8 @@ void LDrawModelViewer::findFileAlertCallback(LDLFindFileAlert *alert)
4046
4046
// below).
4047
4047
std::string lfilename = alert->getFilename ();
4048
4048
std::string url;
4049
- std::string partOutputFilename = LDLModel::lDrawDir ();
4050
- std::string primOutputFilename = LDLModel::lDrawDir ();
4049
+ std::string partOutputFilename = LDLModel::unofficialDir ();
4050
+ std::string primOutputFilename = LDLModel::unofficialDir ();
4051
4051
bool primitive = false ;
4052
4052
bool part = false ;
4053
4053
std::string partUrlBase = libraryUrl (" library/unofficial/parts/" );
@@ -4057,8 +4057,8 @@ void LDrawModelViewer::findFileAlertCallback(LDLFindFileAlert *alert)
4057
4057
4058
4058
replaceStringCharacter (partOutputFilename, ' \\ ' , ' /' );
4059
4059
replaceStringCharacter (primOutputFilename, ' \\ ' , ' /' );
4060
- partOutputFilename += " /Unofficial/ parts/" ;
4061
- primOutputFilename += " /Unofficial/ p/" ;
4060
+ partOutputFilename += " /parts/" ;
4061
+ primOutputFilename += " /p/" ;
4062
4062
convertStringToLower (lfilename);
4063
4063
replaceStringCharacter (lfilename, ' \\ ' , ' /' );
4064
4064
if (stringHasPrefix (lfilename, " 48/" ))
Original file line number Diff line number Diff line change @@ -495,8 +495,11 @@ time_t LDLModel::getLocalTimestamp(const std::string& lfilename)
495
495
}
496
496
if (localTimestamp == 0 )
497
497
{
498
- std::string base;
499
- combinePath (lDrawDir (), " Unofficial" , base);
498
+ std::string base = unofficialDir ();
499
+ if (base.empty ())
500
+ {
501
+ return localTimestamp;
502
+ }
500
503
std::string path;
501
504
combinePath (base, lfilename, path);
502
505
localTimestamp = getFileTimestamp (path);
@@ -1199,6 +1202,23 @@ const char* LDLModel::lDrawDir(bool defaultValue /*= false*/)
1199
1202
}
1200
1203
}
1201
1204
1205
+ // NOTE: static function.
1206
+ std::string LDLModel::unofficialDir (void )
1207
+ {
1208
+ std::string dir (lDrawDir ());
1209
+ if (dir.empty () && !sm_ldrawZipPath.empty ())
1210
+ {
1211
+ dir = directoryFromPath (sm_ldrawZipPath.c_str ());
1212
+ }
1213
+ if (dir.empty ())
1214
+ {
1215
+ return dir;
1216
+ }
1217
+ std::string result;
1218
+ combinePath (dir.c_str (), " Unofficial" , result);
1219
+ return result;
1220
+ }
1221
+
1202
1222
void LDLModel::readComment (LDLCommentLine *commentLine)
1203
1223
{
1204
1224
std::string filename;
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ class LDLModel : public TCAlertSender
125
125
virtual int loadMpdTexmaps (void );
126
126
127
127
static const char *lDrawDir (bool defaultValue = false );
128
+ static std::string unofficialDir (void );
128
129
static void setLDrawDir (const char *value);
129
130
static const std::string& ldrawZipPath (void );
130
131
static bool setLDrawZipPath (const std::string& value);
You can’t perform that action at this time.
0 commit comments