Same file?

Andre Garzia andre at andregarzia.com
Fri Apr 16 18:33:09 EDT 2010


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 <massung at 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 <andre at 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 <massung at 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 at 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 at 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 at 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.



More information about the Use-livecode mailing list