iniLib invalid ini filename - LUA Scripting - CHDK Forum supplierdeeply

iniLib invalid ini filename

  • 2 Replies
  • 1984 Views
*

Offline c_joerg

  • *****
  • 1248
iniLib invalid ini filename
« on: 24 / December / 2019, 11:40:12 »
Advertisements
If I use the iniLib with
Code: [Select]
ini, new = iniLib.read("A/CHDK/DATA/initest.ini")Everythink works fine.
But when I use

Code: [Select]
ini, new = iniLib.read("A/CHDK/initest.ini")I got the error
Code: [Select]
invalid ini filename
But description says

Quote
a simple "filename" without directory and extension is stored to "A/CHDK/DATA/filename.ini"
    for other location  in "A/CHDK/" use a full path and filename
What’s wrong?

 :xmas :xmas :xmas
« Last Edit: 24 / December / 2019, 11:43:12 by c_joerg »
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline reyalp

  • ******
  • 14082
Re: iniLib invalid ini filename
« Reply #1 on: 24 / December / 2019, 16:27:18 »
From looking at the code (but not testing) it expects the name to be in a sub-directory of CHDK/, so A/CHDK/FOO/initest.ini should work, though you must create FOO yourself.

FWIW, you could also borrow serialize and unserialize from chdkptp rlibs.lua https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/rlibs.lua (edit: you'd have to take care of reading/writing the file as a string yourself)
« Last Edit: 24 / December / 2019, 16:33:46 by reyalp »
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1248
Re: iniLib invalid ini filename
« Reply #2 on: 24 / December / 2019, 16:58:00 »
From looking at the code (but not testing) it expects the name to be in a sub-directory of CHDK/, so A/CHDK/FOO/initest.ini should work, though you must create FOO yourself.
Thank you, yes, that's exactly the way it is...
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

 

Related Topics