forked from plugdata-team/plugdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatch.cpp
More file actions
713 lines (578 loc) · 21.1 KB
/
Patch.cpp
File metadata and controls
713 lines (578 loc) · 21.1 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
/*
// Copyright (c) 2015-2022 Pierre Guillot and Timothy Schoen.
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
// WARRANTIES, see the file, "LICENSE.txt," in this distribution.
*/
#include <juce_gui_basics/juce_gui_basics.h>
#include "Utility/Config.h"
#include "Utility/Fonts.h"
#include "Patch.h"
#include "Instance.h"
#include "Interface.h"
#include "Objects/ObjectBase.h"
#include "../PluginEditor.h"
extern "C" {
#include <m_pd.h>
#include <g_canvas.h>
#include <m_imp.h>
#include <utility>
#include "g_undo.h"
extern void canvas_reload(t_symbol* name, t_symbol* dir, t_glist* except);
}
namespace pd {
Patch::Patch(pd::WeakReference patchPtr, Instance* parentInstance, bool ownsPatch, File patchFile)
: instance(parentInstance)
, closePatchOnDelete(ownsPatch)
, lastViewportScale(SettingsFile::getInstance()->getProperty<float>("default_zoom") / 100.0f)
, currentFile(std::move(patchFile))
, ptr(patchPtr)
{
jassert(parentInstance);
updateTitle();
}
Patch::~Patch()
{
// Only close the patch if this is a top-level patch
// Otherwise, this is a subpatcher and it will get cleaned up by Pd
// when the object is deleted
if (closePatchOnDelete && instance) {
instance->setThis();
instance->clearObjectImplementationsForPatch(this); // Make sure that there are no object implementations running in the background!
if (auto patch = ptr.get<void>()) {
libpd_closefile(patch.get());
}
}
}
Rectangle<int> Patch::getGraphBounds() const
{
if (auto cnv = ptr.get<t_canvas>()) {
if (cnv->gl_isgraph) {
cnv->gl_pixwidth = std::max(15, cnv->gl_pixwidth);
cnv->gl_pixheight = std::max(15, cnv->gl_pixheight);
return { cnv->gl_xmargin, cnv->gl_ymargin, cnv->gl_pixwidth, cnv->gl_pixheight };
}
}
return { 0, 0, 0, 0 };
}
Rectangle<int> Patch::getBounds() const
{
if (auto cnv = ptr.get<t_canvas>()) {
auto width = cnv->gl_screenx2 - cnv->gl_screenx1;
auto height = cnv->gl_screeny2 - cnv->gl_screeny1;
return { cnv->gl_screenx1, cnv->gl_screeny1, width, height };
}
return { 0, 0, 0, 0 };
}
bool Patch::isDirty() const
{
return isPatchDirty;
}
bool Patch::canUndo() const
{
return canPatchUndo;
}
bool Patch::canRedo() const
{
return canPatchRedo;
}
void Patch::savePatch(URL const& locationURL)
{
auto location = locationURL.getLocalFile();
String fullPathname = location.getParentDirectory().getFullPathName();
String filename = location.hasFileExtension("pd") ? location.getFileName() : location.getFileName() + ".pd";
auto* dir = instance->generateSymbol(fullPathname.replace("\\", "/"));
auto* file = instance->generateSymbol(filename);
if (auto patch = ptr.get<t_glist>()) {
setTitle(filename);
untitledPatchNum = 0;
canvas_dirty(patch.get(), 0);
#if JUCE_IOS
auto patchText = getCanvasContent();
auto outputStream = locationURL.createOutputStream();
// on iOS, saving with pd's normal method doesn't work
// we need to use an outputstream on a URL
outputStream->write(patchText.toRawUTF8(), patchText.getNumBytesAsUTF8());
outputStream->flush();
instance->logMessage("saved to: " + location.getFullPathName());
canvas_rename(patch.get(), file, dir);
#else
pd::Interface::saveToFile(patch.get(), file, dir);
#endif
currentFile = location;
currentURL = locationURL;
instance->reloadAbstractions(location, patch.get());
}
}
t_glist* Patch::getRoot()
{
if (auto patch = ptr.get<t_canvas>()) {
return canvas_getrootfor(patch.get());
}
return nullptr;
}
bool Patch::isSubpatch()
{
if (auto patch = ptr.get<t_canvas>()) {
return getRoot() != patch.get() && !canvas_isabstraction(patch.get());
}
return false;
}
void Patch::updateUndoRedoState(SmallString undoName, SmallString redoName, bool dirty)
{
if(undoName == "props") undoName = "Change property";
if(redoName == "props") redoName = "Change property";
canPatchUndo = undoName != "no";
canPatchRedo = redoName != "no";
lastUndoSequence = undoName.substring(0, 1).toUpperCase() + undoName.substring(1);
lastRedoSequence = redoName.substring(0, 1).toUpperCase() + redoName.substring(1);
isPatchDirty = dirty;
}
void Patch::savePatch()
{
String fullPathname = currentFile.getParentDirectory().getFullPathName();
String filename = currentFile.hasFileExtension("pd") ? currentFile.getFileName() : currentFile.getFileName() + ".pd";
auto* dir = instance->generateSymbol(fullPathname.replace("\\", "/"));
auto* file = instance->generateSymbol(filename);
if (auto patch = ptr.get<t_glist>()) {
setTitle(filename);
untitledPatchNum = 0;
canvas_dirty(patch.get(), 0);
pd::Interface::saveToFile(patch.get(), file, dir);
}
MessageManager::callAsync([instance = juce::WeakReference(this->instance), file = this->currentFile, ptr = this->ptr]() {
if (instance) {
if (auto patch = ptr.get<t_glist>()) {
instance->reloadAbstractions(file, patch.get());
}
}
});
}
void Patch::setCurrent()
{
if (auto patch = ptr.get<t_glist>()) {
// Ugly fix: plugdata needs gl_havewindow to always be true!
patch->gl_havewindow = true;
canvas_create_editor(patch.get());
}
}
void Patch::setVisible(bool shouldVis)
{
if (auto patch = ptr.get<t_glist>()) {
patch->gl_mapped = shouldVis;
}
}
Connections Patch::getConnections() const
{
Connections connections;
t_outconnect* oc;
t_linetraverser t;
if (auto patch = ptr.get<t_glist>()) {
// Get connections from pd
linetraverser_start(&t, patch.get());
while ((oc = linetraverser_next_nosize(&t))) {
connections.emplace_back(oc, t.tr_inno, t.tr_ob2, t.tr_outno, t.tr_ob);
}
}
return connections;
}
HeapArray<pd::WeakReference> Patch::getObjects()
{
setCurrent();
HeapArray<pd::WeakReference> objects;
if (auto patch = ptr.get<t_glist>()) {
for (t_gobj* y = patch->gl_list; y; y = y->g_next) {
objects.add(pd::WeakReference(y, instance));
}
}
return objects;
}
t_gobj* Patch::createObject(int x, int y, String const& name)
{
StringArray tokens;
tokens.addTokens(name.replace("\\ ", "__%SPACE%__"), true); // Prevent "/ " from being tokenised
ObjectThemeManager::get()->formatObject(tokens);
if (tokens[0] == "garray") {
if (auto patch = ptr.get<t_glist>()) {
auto arrayPasta = "#N canvas 0 0 450 250 (subpatch) 0;\n#X array @arrName 100 float 2;\n#X coords 0 1 100 -1 200 140 1;\n#X restore " + String(x) + " " + String(y) + " graph;";
instance->setThis();
auto* newArraySymbol = pd::Interface::getUnusedArrayName();
arrayPasta = arrayPasta.replace("@arrName", String::fromUTF8(newArraySymbol->s_name));
pd::Interface::paste(patch.get(), arrayPasta.toRawUTF8());
return pd::Interface::getNewest(patch.get());
}
} else if (tokens[0] == "graph") {
if (auto patch = ptr.get<t_glist>()) {
auto graphPasta = "#N canvas 0 0 450 250 (subpatch) 1;\n#X coords 0 1 100 -1 200 140 1 0 0;\n#X restore " + String(x) + " " + String(y) + " graph;";
pd::Interface::paste(patch.get(), graphPasta.toRawUTF8());
return pd::Interface::getNewest(patch.get());
}
}
t_symbol* typesymbol = instance->generateSymbol("obj");
if (tokens[0] == "msg") {
typesymbol = instance->generateSymbol("msg");
tokens.remove(0);
}
if (tokens[0] == "comment") {
typesymbol = instance->generateSymbol("text");
tokens.remove(0);
}
if (tokens[0] == "floatbox") {
typesymbol = instance->generateSymbol("floatatom");
tokens.remove(0);
}
if (tokens[0] == "listbox") {
typesymbol = instance->generateSymbol("listbox");
tokens.remove(0);
}
if (tokens[0] == "symbolbox") {
typesymbol = instance->generateSymbol("symbolatom");
tokens.remove(0);
}
if (tokens[0] == "+") {
tokens.set(0, "\\+");
}
tokens.removeEmptyStrings();
int argc = tokens.size() + 2;
auto argv = SmallArray<t_atom>(argc);
// Set position
SETFLOAT(argv.data(), static_cast<float>(x));
SETFLOAT(argv.data() + 1, static_cast<float>(y));
for (int i = 0; i < tokens.size(); i++) {
// check if string is a valid number
auto token = tokens[i].replace("__%SPACE%__", "\\ ");
auto charptr = token.getCharPointer();
auto ptr = charptr;
CharacterFunctions::readDoubleValue(ptr); // This will read the number and increment the pointer to be past the number
if (ptr - charptr == token.getNumBytesAsUTF8()) {
SETFLOAT(argv.data() + i + 2, token.getFloatValue());
} else {
SETSYMBOL(argv.data() + i + 2, instance->generateSymbol(token));
}
}
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
return pd::Interface::createObject(patch.get(), typesymbol, argc, argv.data());
}
return nullptr;
}
t_gobj* Patch::renameObject(t_object* obj, String const& name)
{
StringArray tokens;
tokens.addTokens(name, false);
ObjectThemeManager::get()->formatObject(tokens);
String newName = tokens.joinIntoString(" ");
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::renameObject(patch.get(), &obj->te_g, newName.toRawUTF8(), newName.getNumBytesAsUTF8());
return pd::Interface::getNewest(patch.get());
}
return nullptr;
}
void Patch::copy(SmallArray<t_gobj*> const& objects)
{
if (auto patch = ptr.get<t_glist>()) {
int size;
char const* text = pd::Interface::copy(patch.get(), &size, objects);
auto copied = String::fromUTF8(text, size);
MessageManager::callAsync([copied]() mutable { SystemClipboard::copyTextToClipboard(copied); });
}
}
String Patch::translatePatchAsString(String const& patchAsString, Point<int> position)
{
int minX = std::numeric_limits<int>::max();
int minY = std::numeric_limits<int>::max();
int canvasDepth = 0;
auto isObject = [](StringArray& tokens) {
return tokens[0] == "#X" && tokens[1] != "connect" && tokens[1] != "f" && tokens[2].containsOnly("-0123456789") && tokens[3].containsOnly("-0123456789");
};
// blank message objects have a comma after their position: "#X msg 0 0, f 9;"
// this normally isn't an issue, but because they are blank, the comma is next to the number token and doesn't get parsed correctly
auto isMsg = [](StringArray& tokens) {
return tokens[0] == "#X" && tokens[1] == "msg";
};
auto isStartingCanvas = [](StringArray& tokens) {
return tokens[0] == "#N" && tokens[1] == "canvas" && tokens[2].containsOnly("-0123456789") && tokens[3].containsOnly("-0123456789") && tokens[4].containsOnly("-0123456789") && tokens[5].containsOnly("-0123456789");
};
auto isEndingCanvas = [](StringArray& tokens) {
return tokens[0] == "#X" && tokens[1] == "restore" && tokens[2].containsOnly("-0123456789") && tokens[3].containsOnly("-0123456789");
};
for (auto& line : StringArray::fromLines(patchAsString)) {
line = line.upToLastOccurrenceOf(";", false, false);
auto tokens = StringArray::fromTokens(line, true);
if (isStartingCanvas(tokens)) {
canvasDepth++;
}
if (canvasDepth == 0) {
if (isObject(tokens)) {
minX = std::min(minX, tokens[2].getIntValue());
minY = std::min(minY, tokens[3].getIntValue());
} else if (isMsg(tokens)) {
minX = std::min(minX, tokens[2].getIntValue());
minY = std::min(minY, tokens[3].removeCharacters(",").getIntValue());
}
}
if (isEndingCanvas(tokens)) {
if (canvasDepth == 1) {
minX = std::min(minX, tokens[2].getIntValue());
minY = std::min(minY, tokens[3].getIntValue());
}
canvasDepth--;
}
}
canvasDepth = 0;
auto toPaste = StringArray::fromLines(patchAsString);
for (auto& line : toPaste) {
line = line.upToLastOccurrenceOf(";", false, false);
auto tokens = StringArray::fromTokens(line, true);
if (isStartingCanvas(tokens)) {
canvasDepth++;
}
if (canvasDepth == 0) {
if (isObject(tokens)) {
tokens.set(2, String(tokens[2].getIntValue() - minX + position.x));
tokens.set(3, String(tokens[3].getIntValue() - minY + position.y));
line = tokens.joinIntoString(" ");
} else if (isMsg(tokens)) {
tokens.set(2, String(tokens[2].getIntValue() - minX + position.x));
tokens.set(3, String(tokens[3].removeCharacters(",").getIntValue() - minY + position.y) + ",");
line = tokens.joinIntoString(" ");
}
}
if (isEndingCanvas(tokens)) {
if (canvasDepth == 1) {
tokens.set(2, String(tokens[2].getIntValue() - minX + position.x));
tokens.set(3, String(tokens[3].getIntValue() - minY + position.y));
}
line = tokens.joinIntoString(" ");
canvasDepth--;
}
line += ";";
}
return toPaste.joinIntoString("\n");
}
void Patch::paste(Point<int> position)
{
auto text = SystemClipboard::getTextFromClipboard();
auto translatedObjects = translatePatchAsString(text, position);
if (auto patch = ptr.get<t_glist>()) {
pd::Interface::paste(patch.get(), translatedObjects.toRawUTF8());
}
}
void Patch::duplicate(SmallArray<t_gobj*> const& objects, t_outconnect* connection)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::duplicateSelection(patch.get(), objects, connection);
}
}
void Patch::deselectAll()
{
if (auto patch = ptr.get<t_glist>()) {
glist_noselect(patch.get());
}
}
bool Patch::hasConnection(t_object* src, int nout, t_object* sink, int nin)
{
if (auto patch = ptr.get<t_glist>()) {
return pd::Interface::hasConnection(patch.get(), src, nout, sink, nin);
}
return false;
}
bool Patch::canConnect(t_object* src, int nout, t_object* sink, int nin)
{
if (auto patch = ptr.get<t_glist>()) {
return pd::Interface::canConnect(patch.get(), src, nout, sink, nin);
}
return false;
}
void Patch::createConnection(t_object* src, int nout, t_object* sink, int nin)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::createConnection(patch.get(), src, nout, sink, nin);
}
}
t_outconnect* Patch::createAndReturnConnection(t_object* src, int nout, t_object* sink, int nin)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
return pd::Interface::createConnection(patch.get(), src, nout, sink, nin);
}
return nullptr;
}
void Patch::removeConnection(t_object* src, int nout, t_object* sink, int nin, t_symbol* connectionPath)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::removeConnection(patch.get(), src, nout, sink, nin, connectionPath);
}
}
t_outconnect* Patch::setConnctionPath(t_object* src, int nout, t_object* sink, int nin, t_symbol* oldConnectionPath, t_symbol* newConnectionPath)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
return pd::Interface::setConnectionPath(patch.get(), src, nout, sink, nin, oldConnectionPath, newConnectionPath);
}
return nullptr;
}
void Patch::moveObjects(SmallArray<t_gobj*> const& objects, int dx, int dy)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::moveObjects(patch.get(), dx, dy, objects);
}
}
void Patch::moveObjectTo(t_gobj* object, int x, int y)
{
if (auto patch = ptr.get<t_glist>()) {
// Originally this was +1544, but caused issues with alignment tools being off-by xy +2px.
// FIXME: why do we have to do this at all?
pd::Interface::moveObject(patch.get(), object, x + 1542, y + 1542);
}
}
void Patch::finishRemove()
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::finishRemove(patch.get());
}
}
void Patch::removeObjects(SmallArray<t_gobj*> const& objects)
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd::Interface::removeObjects(patch.get(), objects);
}
}
void Patch::startUndoSequence(String const& name)
{
if (auto patch = ptr.get<t_glist>()) {
canvas_undo_add(patch.get(), UNDO_SEQUENCE_START, instance->generateSymbol(name)->s_name, nullptr);
}
}
void Patch::endUndoSequence(String const& name)
{
if (auto patch = ptr.get<t_glist>()) {
canvas_undo_add(patch.get(), UNDO_SEQUENCE_END, instance->generateSymbol(name)->s_name, nullptr);
}
}
void Patch::undo()
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
auto x = patch.get();
glist_noselect(x);
pd::Interface::undo(patch.get());
}
}
void Patch::redo()
{
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
auto x = patch.get();
glist_noselect(x);
pd::Interface::redo(patch.get());
}
}
void Patch::updateTitle(SmallString const& newTitle)
{
title = newTitle;
}
void Patch::updateTitle()
{
if (auto patch = ptr.get<t_glist>()) {
String name = String::fromUTF8(patch->gl_name->s_name);
int argc = 0;
t_atom* argv = nullptr;
canvas_setcurrent(patch.get());
canvas_getargs(&argc, &argv);
canvas_unsetcurrent(patch.get());
if (argc) {
char namebuf[MAXPDSTRING];
name += " (";
for (int i = 0; i < argc; i++) {
atom_string(&argv[i], namebuf, MAXPDSTRING);
name += String::fromUTF8(namebuf);
if (i != argc - 1)
name += " ";
}
name += ")";
}
title = name.isEmpty() ? "Untitled Patcher" : name;
}
else {
title = "Untitled Patcher";
}
}
String Patch::getTitle() const
{
return title.toString();
}
void Patch::setTitle(String const& newTitle)
{
title = newTitle;
auto* pathSym = instance->generateSymbol(getCurrentFile().getFullPathName());
StackArray<t_atom, 2> args;
SETSYMBOL(&args[0], instance->generateSymbol(title));
SETSYMBOL(&args[1], pathSym);
if (auto patch = ptr.get<t_glist>()) {
setCurrent();
pd_typedmess(patch.cast<t_pd>(), instance->generateSymbol("rename"), 2, args.data());
}
MessageManager::callAsync([instance = this->instance]() {
instance->titleChanged();
});
}
void Patch::setUntitled()
{
// find the lowest `Untitled-N` number, for the new patch title
int lowestNumber = 0;
for (auto patch : instance->patches) {
lowestNumber = std::max(lowestNumber, patch->untitledPatchNum);
}
lowestNumber += 1;
untitledPatchNum = lowestNumber;
setTitle("Untitled-" + String(lowestNumber));
}
File Patch::getCurrentFile() const
{
return currentFile;
}
// This gets the raw patch path from Pd instead of our own stored path
// We should probably move over to using this everywhere eventually
File Patch::getPatchFile() const
{
if (auto patch = ptr.get<t_glist>()) {
auto* dir = canvas_getdir(patch.get())->s_name;
auto* name = patch->gl_name->s_name;
return File(String::fromUTF8(dir)).getChildFile(String::fromUTF8(name)).getFullPathName();
}
return File();
}
void Patch::setCurrentFile(URL const& newURL)
{
currentFile = newURL.getLocalFile();
currentURL = newURL;
}
String Patch::getCanvasContent()
{
char* buf;
int bufsize;
if (auto patch = ptr.get<t_canvas>()) {
pd::Interface::getCanvasContent(patch.get(), &buf, &bufsize);
} else {
return {};
}
auto content = String::fromUTF8(buf, static_cast<size_t>(bufsize));
freebytes(static_cast<void*>(buf), static_cast<size_t>(bufsize) * sizeof(char));
return content;
}
void Patch::reloadPatch(File const& changedPatch, t_glist* except)
{
sys_lock();
auto* dir = gensym(changedPatch.getParentDirectory().getFullPathName().replace("\\", "/").toRawUTF8());
auto* file = gensym(changedPatch.getFileName().toRawUTF8());
canvas_reload(file, dir, except);
sys_unlock();
}
} // namespace pd