TorqueLab Develeopment Discussions
PublicTorqueLab Develeopment

Mud-H created this room.
Mud-H created this object with visibility "All Users".

1//This is mostly just a test for the Snippets and is not very clean...
2
3//==============================================================================
4// Handle the escape bind
5function doPathCopy(%srcFile,%tgtFile,%noOverwrite,%unique)
6{
7 %tgtFile = getUniqueFilename(%tgtFile);
8 createPath(%tgtFile);
9
10 %result = pathCopy(%srcFile,%tgtFile,%noOverwrite);
11 return %result;
12}
13//------------------------------------------------------------------------------
14//==============================================================================
15// Handle the escape bind
16function backupFileExt(%file,%extension)
17{
18 %file = makeRelativePath(%file);
19 %newFile = %file@"."@%extension;
20 %success = doPathCopy(%file,%newFile,false,true);
21
22 if (%success)
23 return %newFile;
24
25 return;
26}
27//------------------------------------------------------------------------------
28//==============================================================================
29// Handle the escape bind
30function backupFileHome(%this,%file,%unique,%homeSubDir)
31{
32 %ext = fileExt(%file);
33 %fileName = fileBase(%file);
34 %relPath = makeRelativePath(%file);
35 %filePath = filePath(%relPath);
36 %newFile = %filePath@"/"@%fileName@"_"@localTime("timestamp")@%ext@".bak";
37 %newFile = strreplace(%newFile,"//","/");
38
39 //Store it into User Home APP/
40 %newFile = getLocalFolder(%homeSubDir)@"/"@%newFile;
41 %success = doPathCopy(%file,%newFile,false);
42
43 if (%success)
44 return %newFile;
45
46 return;
47}
48//------------------------------------------------------------------------------
49//==============================================================================
50// Handle the escape bind
51function backupFileUser(%this,%file,%unique,%homeSubDir)
52{
53 %file = makeRelativePath(%file);
54 %newFile = getLocalFolder(%homeSubDir)@"/"@%file;
55 %success = doPathCopy(%file,%newFile,false,%unique);
56
57 if (%success)
58 return %newFile;
59
60 return;
61}
62//------------------------------------------------------------------------------

Mud-H changed the visibility from "All Users" to "Public (No Login Required)".