Re: Same file?

2010-04-28 Thread Douglas

If you have write access permissions to the path(s) then you could try

1. Split off the file names at the end of path1 and path2
2. Save a dummy file to path1. - (OK, a problem if you don't have write 
access permission to the path)

3. See if the dummy file exists on path2.

Douglas

= ^-^ =
Le Chat - A cartoon strip so pretentious that it doesn't even have a 
cartoon!


What do you mean - Don't you want your food? - This is NOT what I ordered!

On 16/04/2010 22:21, Jeff Massung wrote:

Is there a nice little way in Rev to check and see if two file paths are the
same? For example:

../../../Home/jeff/foo.txt
/Users/Home/jeff/foo.txt
c:\Users\Home\jeff\foo.txt

These may all actually be the same file. Before I go down the road of
directory traversals, file path separators, and drive name parsing... is
there a way for me to know in Rev if they are the same easily?

Jeff M.
   


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Same file?

2010-04-16 Thread Jeff Massung
Is there a nice little way in Rev to check and see if two file paths are the
same? For example:

../../../Home/jeff/foo.txt
/Users/Home/jeff/foo.txt
c:\Users\Home\jeff\foo.txt

These may all actually be the same file. Before I go down the road of
directory traversals, file path separators, and drive name parsing... is
there a way for me to know in Rev if they are the same easily?

Jeff M.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Björnke von Gierke
if there is a file any/valid/rev/internal/path then


On 16 Apr 2010, at 23:21, Jeff Massung wrote:

 Is there a nice little way in Rev to check and see if two file paths are the
 same? For example:
 
 ../../../Home/jeff/foo.txt
 /Users/Home/jeff/foo.txt
 c:\Users\Home\jeff\foo.txt
 
 These may all actually be the same file. Before I go down the road of
 directory traversals, file path separators, and drive name parsing... is
 there a way for me to know in Rev if they are the same easily?
 
 Jeff M.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Andre Garzia
Jeff,

put the md5digest of url (binfile:  path1) into tMD5file1
put the md5digest of url (binfile:  path2) into tMD5file2
if tMD5file1 is tMD5file2 then
  return true
else
  return false
end if

PS: this checks for the equality of files no matter the path, if you want
just to see if the paths are equivalent then it is another business.

On Fri, Apr 16, 2010 at 6:21 PM, Jeff Massung mass...@gmail.com wrote:

 Is there a nice little way in Rev to check and see if two file paths are
 the
 same? For example:

 ../../../Home/jeff/foo.txt
 /Users/Home/jeff/foo.txt
 c:\Users\Home\jeff\foo.txt

 These may all actually be the same file. Before I go down the road of
 directory traversals, file path separators, and drive name parsing... is
 there a way for me to know in Rev if they are the same easily?

 Jeff M.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Jeff Massung
Ya, I really don't want to compare the data in the files, just whether the
paths point to the same final location.

Thanks, though.

Jeff M.

On Fri, Apr 16, 2010 at 5:19 PM, Andre Garzia an...@andregarzia.com wrote:

 Jeff,

 put the md5digest of url (binfile:  path1) into tMD5file1
 put the md5digest of url (binfile:  path2) into tMD5file2
 if tMD5file1 is tMD5file2 then
  return true
 else
  return false
 end if

 PS: this checks for the equality of files no matter the path, if you want
 just to see if the paths are equivalent then it is another business.

 On Fri, Apr 16, 2010 at 6:21 PM, Jeff Massung mass...@gmail.com wrote:

  Is there a nice little way in Rev to check and see if two file paths are
  the
  same? For example:
 
  ../../../Home/jeff/foo.txt
  /Users/Home/jeff/foo.txt
  c:\Users\Home\jeff\foo.txt
 
  These may all actually be the same file. Before I go down the road of
  directory traversals, file path separators, and drive name parsing... is
  there a way for me to know in Rev if they are the same easily?
 
  Jeff M.
  ___
  use-revolution mailing list
  use-revolution@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-revolution
 



 --
 http://www.andregarzia.com All We Do Is Code.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Andre Garzia
tricky,

if you can trust the input (meaning you assembled it and not your user) then
something along the lines of

shell(cd  path1 ; pwd)

will return a root relative path, you can use them to compare the folders. I
believe pwd is unix-like only, don't know the windows equivalent. Also be
aware that if path1 contains commands, they will execute and this
potentially letal to HD and systems. Use with care and don't sue me!

On Fri, Apr 16, 2010 at 7:30 PM, Jeff Massung mass...@gmail.com wrote:

 Ya, I really don't want to compare the data in the files, just whether the
 paths point to the same final location.

 Thanks, though.

 Jeff M.

 On Fri, Apr 16, 2010 at 5:19 PM, Andre Garzia an...@andregarzia.com
 wrote:

  Jeff,
 
  put the md5digest of url (binfile:  path1) into tMD5file1
  put the md5digest of url (binfile:  path2) into tMD5file2
  if tMD5file1 is tMD5file2 then
   return true
  else
   return false
  end if
 
  PS: this checks for the equality of files no matter the path, if you want
  just to see if the paths are equivalent then it is another business.
 
  On Fri, Apr 16, 2010 at 6:21 PM, Jeff Massung mass...@gmail.com wrote:
 
   Is there a nice little way in Rev to check and see if two file paths
 are
   the
   same? For example:
  
   ../../../Home/jeff/foo.txt
   /Users/Home/jeff/foo.txt
   c:\Users\Home\jeff\foo.txt
  
   These may all actually be the same file. Before I go down the road of
   directory traversals, file path separators, and drive name parsing...
 is
   there a way for me to know in Rev if they are the same easily?
  
   Jeff M.
   ___
   use-revolution mailing list
   use-revolution@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-revolution
  
 
 
 
  --
  http://www.andregarzia.com All We Do Is Code.
  ___
  use-revolution mailing list
  use-revolution@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-revolution
 
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Richard Gaskin

Andre wrote:


put the md5digest of url (binfile:  path1) into tMD5file1
put the md5digest of url (binfile:  path2) into tMD5file2
if tMD5file1 is tMD5file2 then
  return true
else
  return false
end if


Andre, you've been programming too deeply for too long. :)

MD5digest is great for storing small signatures of large files, but 
since the function reads the full file contents it can simply use:


  if url (binfile: path1) is url (binfile: path2) then
  ...

You're not alone:  this morning I caught myself writing 20 beautifully 
complex lines to do something that later occurred to me could be done in 
a single line that was much easier to read. :)


The seductive beauty of RevTalk

--
 Richard Gaskin
 Fourth World
 Rev training and consulting: http://www.fourthworld.com
 Webzine for Rev developers: http://www.revjournal.com
 revJournal blog: http://revjournal.com/blog.irv
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: Same file?

2010-04-16 Thread Paul D. DeRocco
 From: Richard Gaskin

 Andre wrote:

  put the md5digest of url (binfile:  path1) into tMD5file1
  put the md5digest of url (binfile:  path2) into tMD5file2
  if tMD5file1 is tMD5file2 then
return true
  else
return false
  end if

 Andre, you've been programming too deeply for too long. :)

 MD5digest is great for storing small signatures of large files, but
 since the function reads the full file contents it can simply use:

if url (binfile: path1) is url (binfile: path2) then
...

I expect that loads both files into RAM in their entirety before comparing
them, while computing a digest of each doesn't.

--

Ciao,   Paul D. DeRocco
Paulmailto:pdero...@ix.netcom.com

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Same file?

2010-04-16 Thread Richard Gaskin

Paul D. DeRocco wrote:


From: Richard Gaskin

Andre wrote:

 put the md5digest of url (binfile:  path1) into tMD5file1
 put the md5digest of url (binfile:  path2) into tMD5file2
 if tMD5file1 is tMD5file2 then
   return true
 else
   return false
 end if

Andre, you've been programming too deeply for too long. :)

MD5digest is great for storing small signatures of large files, but
since the function reads the full file contents it can simply use:

   if url (binfile: path1) is url (binfile: path2) then
   ...


I expect that loads both files into RAM in their entirety before comparing
them, while computing a digest of each doesn't.


There may be ways to compute a digest without reading the file into 
memory in other systems, but IIRC Rev's md5digest function only works on 
data, not file specs.


Also, to the engine this:

  put the md5digest of url (binfile:  path1) into tMD5file1

Looks like:

  put url (binfile:  path1) into someUnspecifiedContainer
  put md5Digest(someUnspecifiedContainer) into tMD5file1


Rev's insistence that it calculates the digest from contents in memory 
is the subject of an RQCC request:

http://quality.runrev.com/qacenter/show_bug.cgi?id=2410

--
 Richard Gaskin
 Fourth World
 Rev training and consulting: http://www.fourthworld.com
 Webzine for Rev developers: http://www.revjournal.com
 revJournal blog: http://revjournal.com/blog.irv
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution