GithubHelp home page GithubHelp logo

Comments (4)

aslze avatar aslze commented on June 3, 2024

FYI, if you have multiple repeated options, you can use the () operator to get all values. Operator [] will only give you one (the last). args("option") returns an array with all values for the given option, unlike args["option"]:

Array<String> cfs = args("cf"); // -> ["config/readmesh.ini", "data/checkmesh/cubeandisolatedvertex.obj"]

for(auto cf : cfs)
{
    read(cf);
}

Parsing multiple options does not seem to be the problem. The crash appears in IniFile which seems to be parsing a badly formatted file. I just identified a possible cause that I'll try to fix. It expects an '=' sign which might be missing in the file. Is the ini file correct?

Anyway, are you passing "cubeandisolatedvertex.obj" to the IniFile reader? Is that an INI-like file?

from asl.

aslze avatar aslze commented on June 3, 2024

The crash happened in the IniFile destructor. It checks if we have modified or added any values, to save the file in that case. And there it encountered some missing '='.

I fixed that and another case (if there is a line starting with [ but not closing with ]). Now it will be more forgiving.

It's in the latest master version (pull the latest git version or download the repository zip).

from asl.

kabukunz avatar kabukunz commented on June 3, 2024

An example ini file:

[iteration0]
inputfilename=data/alltriscube.obj
source=0
operation=6
[iteration1]
source=0
operation=7
outputfilename=YES
[iteration2]
source=0
operation=4
# end

you're right, the problem is the obj file passed in place of ini one. It is a text file of the form:

# Blender v2.79 (sub 0) OBJ File: 'triplane_cone_triscube_cube8.blend'
# www.blender.org
v -1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
s off
f 2 3 1
f 4 7 3
f 8 5 7
f 6 1 5
f 7 1 3
f 4 6 8
f 2 4 3
f 4 8 7
f 8 6 5
f 6 2 1
f 7 5 1
f 4 2 6
l 2 0
l 3 2
l 3 7
l 7 5
l 5 4
l 0 4

if I do:

test/at3d -cf data/alltriscube.obj

the error above shows up. Curiously enough, just discovered, if I do:

test/at3d -cf data/

that is passing only a directory without file, debugger shows everything stops at line 79, never returing. Sanitizers are silent.

I'll modify the code so as to manage multiple options the way you showed. Thank you for your help.

from asl.

aslze avatar aslze commented on June 3, 2024

Anyway, shouldn't the obj file be assigned to a different option (not -cf) since it is not a config file?

test/at3d -cf config/readmesh.ini -obj data/checkmesh/cubeandisolatedvertex.obj

-cf for config file and -obj for input obj file. Or even without an option:

test/at3d -cf config/readmesh.ini data/checkmesh/cubeandisolatedvertex.obj

There you will have

args.length(); // -> 1: number of free arguments which are not options
args[0]; // -> "data/checkmesh/cubeandisolatedvertex.obj"
args["cf"]; // -> "config/readmesh.ini"

from asl.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.