Re: [PD] Reading txt file inside folder

2013-08-30 Thread Frank Barknecht
On Wed, Aug 28, 2013 at 07:31:54PM -0700, Ronni Montoya wrote:
 hi,[read ../data/colors.txt ( doesnt work here on macosx.
 
 I ve tried in the following way and it worked.
 
 [ read data/colors.txt (
 
 
 I was wondering if the way im doing this will allow the patch to work
 only on macosx?
 
 If yes, is there is a way of solving this?

Pd's way of referencing files with relative paths can be a bit peculiar, 
because depending
on where your patches and abstractions are and what is the Pd search path you 
have configured, 
Pd might use different places to start its file search.

Unless you can use absolute paths, in my experience a good way to help Pd
looking for files is to use a [declare]-object in your toplevel patch to add
the directory, where the toplevel patch file is to the search path. 

So in your toplevel file, lets assume it's called main.pd, use declare like 
this: 

 [declare -path .]

The final dot (.) is the current directory, where main.pd is, which would be 
workdir in a 
tree like this:


- workdir/
  - main.pd- add [declare -path .] here and use as main patch
  - other.pd
  - mylib/
 filereader.pd
  - data1/
- colors.txt
- data2/
  - colors.txt

After that can use all these to open files:

 [read data1/colors.txt (
 [read ../data2/colors.txt (

and it should even work, if yout have a [mylib/filereader] abstraction in
main.pd, that has your [textfile] inside.

All this is not dependent on the operating system, so it will work on OS-X,
Linux, iOS, Android, etc.

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Reading txt file inside folder

2013-08-28 Thread Lorenzo Sutton

On 28/08/2013 02:17, Ronni Montoya wrote:

Hi , i have a folder with my pd patch and another folder that stores
txt files ( my data).

How can i read my txt files from that folder using relative path?
I need to be able to change the location of my folder and not having
the necessity of rewriting the path.



any idea?

Assuming you're using [textfile], something like this should work

[read ../path_to_file/file.txt(
|
[textfile]

Lorenzo.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Reading txt file inside folder

2013-08-28 Thread Ronni Montoya
hi,[read ../data/colors.txt ( doesnt work here on macosx.

I ve tried in the following way and it worked.

[ read data/colors.txt (


I was wondering if the way im doing this will allow the patch to work
only on macosx?

If yes, is there is a way of solving this?

2013/8/28, Lorenzo Sutton lorenzofsut...@gmail.com:
 On 28/08/2013 02:17, Ronni Montoya wrote:
 Hi , i have a folder with my pd patch and another folder that stores
 txt files ( my data).

 How can i read my txt files from that folder using relative path?
 I need to be able to change the location of my folder and not having
 the necessity of rewriting the path.



 any idea?
 Assuming you're using [textfile], something like this should work

 [read ../path_to_file/file.txt(
 |
 [textfile]

 Lorenzo.

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] Reading txt file inside folder

2013-08-27 Thread Ronni Montoya
Hi , i have a folder with my pd patch and another folder that stores
txt files ( my data).

How can i read my txt files from that folder using relative path?
I need to be able to change the location of my folder and not having
the necessity of rewriting the path.



any idea?


R.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list