rejetto forum
May 25, 2012, 09:50:17 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: A couple of macro requests  (Read 602 times)
0 Members and 1 Guest are viewing this topic.
Flynsarmy
Experienced poster
***
Offline Offline

Afghanistan Afghanistan

Posts: 92


DENIED!


View Profile WWW
« on: September 01, 2009, 02:40:59 AM »

I'm not sure if there are undocumented macros that already do this, but could you please add
{.exists.} - accepts path/path+filename. returns true if folder/file exists respectively.
{.isfile.} - accepts path/path+filename. returns true if path is a file instead of folder (some files dont have file extensions).
The reason for {.isfile.} is because if you have a file with no file extension it could look like a folder. also {.isfile.} could be combined with {.exists.} to determine if a file exists or a folder exists.

I was using filesize before but this returns 0 for empty files or folders (which would indicate that they dont exist) and md5 is ALOT slower - speed is important.

The reason i ask for these is because I currently use this code:
{.copy|{.postvar|src.}|{.postvar|destination.}.}
{.if|{.filesize|{.postvar|destination.}.}|1|0.}

It performs a copy then returns 1 if the destination file exists on the hard drive (successful copy) or 0 if the destination file doesn't exist (failed copy). This is perfect unless the file size is 0 in which case i have no way of telling if the destination file exists or not...

Another, much preferred solution would be to have both the move and copy macros return true on a successful operation and false on a failed operation. This would allow me to do this:
{.if|{.copy|{.postvar|src.}|{.postvar|destination.}.}|1|0.}
« Last Edit: September 01, 2009, 06:45:29 AM by Flynsarmy » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #1 on: September 04, 2009, 09:03:54 AM »

you will get both macros in next build.

anyway, i guess this is not documented, but several commands that apparently return no result, but you would like to, actually DO. Smiley
they return a white space or not.
this way, you can
{.if|{.length|{.copy|SOURCE|DESTINATION.}.}|all right|something's wrong.}

i will document this fact
« Last Edit: September 04, 2009, 09:09:56 AM by rejetto » Logged
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« Reply #2 on: September 04, 2009, 09:06:47 AM »

{.copy|from|to.}  Huh?

missing something? not ?
{.copy|url|from|to.}
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #3 on: September 04, 2009, 09:09:36 AM »

"from" and "to" are meta-names, supposed to be replaced by the real content Wink
not meant to be named parameters from=XXX
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 20, 2012, 10:08:36 AM
anything