SQLite revOpenDatabase() and Relative File Paths

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SQLite revOpenDatabase() and Relative File Paths

Kay C Lan
This works

put the defaultFolder & "/Folder Name/mySQLite.db" into tPath
get revOpenDatabase("sqlite",tPath,,,)

But this doesn't

get revOpenDatabase("sqlite","/Folder Name/mySQLite.db",,,)

I thought the point of the defaultFolder was so you didn't have to
continually build full file paths but could use relative file paths when LC
needed a path.

What am I doing wrong?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SQLite revOpenDatabase() and Relative File Paths

Jan Schenkel
Hi Kay,

Untested, but does it work if you put a period before the relative path?
   get revOpenDatabase("sqlite","./Folder Name/mySQLite.db",,,)
Otherwise the operating system may think you're trying to open a dataabse on a volume called 'Folder Name'

HTH,

Jan Schenkel.

=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

--------------------------------------------
On Wed, 2/19/14, Kay C Lan <[hidden email]> wrote:

 Subject: SQLite revOpenDatabase() and Relative File Paths
 To: "How to use LiveCode" <[hidden email]>
 Date: Wednesday, February 19, 2014, 9:54 PM
 
 This works
 
 put the defaultFolder & "/Folder Name/mySQLite.db" into
 tPath
 get revOpenDatabase("sqlite",tPath,,,)
 
 But this doesn't
 
 get revOpenDatabase("sqlite","/Folder Name/mySQLite.db",,,)
 
 I thought the point of the defaultFolder was so you didn't
 have to
 continually build full file paths but could use relative
 file paths when LC
 needed a path.
 
 What am I doing wrong?
 _______________________________________________
 use-livecode mailing list
 [hidden email]
 Please visit this url to subscribe, unsubscribe and manage
 your subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SQLite revOpenDatabase() and Relative File Paths

Devin Asay
In reply to this post by Kay C Lan

On Feb 19, 2014, at 10:54 PM, Kay C Lan <[hidden email]> wrote:

> This works
>
> put the defaultFolder & "/Folder Name/mySQLite.db" into tPath
> get revOpenDatabase("sqlite",tPath,,,)
>
> But this doesn't
>
> get revOpenDatabase("sqlite","/Folder Name/mySQLite.db",,,)
>
> I thought the point of the defaultFolder was so you didn't have to
> continually build full file paths but could use relative file paths when LC
> needed a path.
>
> What am I doing wrong?

Kay,

You don't need the leading "/" in the relative file path. With the defaultFolder set to the parent folder of Folder Name, you simply use "Folder Name/mySQLite.db" as the path.

Regards,

Devin

Devin Asay
Office of Digital Humanities
Brigham Young University


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SQLite revOpenDatabase() and Relative File Paths

Dr. Hawkins
On Thu, Feb 20, 2014 at 7:34 AM, Devin Asay <[hidden email]> wrote:

> On Feb 19, 2014, at 10:54 PM, Kay C Lan <[hidden email]> wrote:
>
>

> > get revOpenDatabase("sqlite","/Folder Name/mySQLite.db",,,)
>
>  You don't need the leading "/" in the relative file path. With the
> defaultFolder set to the parent folder of Folder Name, you simply use
> "Folder Name/mySQLite.db" as the path.
>

It's more than "don't need."  You *must not* do that if you want a relative
path.  The leading /  tells it to go the the root of the file system.
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SQLite revOpenDatabase() and Relative File Paths

Kay C Lan
In reply to this post by Devin Asay
Devin, Doc,

Thanks, that nailed it.


On Thu, Feb 20, 2014 at 11:34 PM, Devin Asay <[hidden email]> wrote:

> You don't need the leading "/" in the relative file path. With the
> defaultFolder set to the parent folder of Folder Name, you simply use
> "Folder Name/mySQLite.db" as the path.
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode