Git Product home page Git Product logo

Comments (7)

TheKodeToad avatar TheKodeToad commented on September 27, 2024

The New Instance dialog allows you to customise the name - and the placeholder text indicates the name it will use by default.

The problem is, this means we need to determine the name before the dialog is submitted. The instance.cfg location in the file is not defined so it could require scanning a large part of the file.

from prismlauncher.

cswimr avatar cswimr commented on September 27, 2024

For Prism Launcher exports specifically, is there any reason the instance.cfg file wouldn't be in the root of the .zip file, assuming the file was exported through Prism Launcher and not zipped manually? I'd imagine the subset of users who are manually zipping export files and changing the location of instance.cfg is pretty small.

Alternatively, it could check a specific path in the .zip (/instance.cfg) for the configuration file, and if it doesn't find it, then default to the name of the .zip file?

from prismlauncher.

Trial97 avatar Trial97 commented on September 27, 2024

Because we need to extract that file to read it and get that name, and the extraction happens at the end.
The reason we do not do the extraction first is that the user may not want to finish adding that instance when selecting the zip file.
This issue is similar to: #876 (comment) but instead of displaying the name of the instance that one requests displaying the icon that is inside the zip folder.

from prismlauncher.

TheKodeToad avatar TheKodeToad commented on September 27, 2024

For Prism Launcher exports specifically, is there any reason the instance.cfg file wouldn't be in the root of the .zip file, assuming the file was exported through Prism Launcher and not zipped manually? I'd imagine the subset of users who are manually zipping export files and changing the location of instance.cfg is pretty small.

Alternatively, it could check a specific path in the .zip (/instance.cfg) for the configuration file, and if it doesn't find it, then default to the name of the .zip file?

Well, moving the instance.cfg wouldn't be valid - I'm not saying we should account for that. I don't know exactly how zip files are structured, but are files in the root guaranteed to be near the start of the file? I doubt it. Also, checking for a specific path involves iterating over every entry I'm pretty sure (although you can probably skip a lot of data on local files).

from prismlauncher.

cswimr avatar cswimr commented on September 27, 2024

Ok, so if extracting before the user confirms installation isn't a good idea, what if it changed the instance name during installation instead? If the user specifies a name, use that name and ignore the instance.cfg file, but if the name would be the same as the .zip file's name, then read the instance.cfg file and use the name key from that file? It'd look kinda weird in the UI but it'd work. Could disable name previews for .zip files maybe?

from prismlauncher.

DFreezerR avatar DFreezerR commented on September 27, 2024

Because we need to extract that file to read it and get that name, and the extraction happens at the end. The reason we do not do the extraction first is that the user may not want to finish adding that instance when selecting the zip file. This issue is similar to: #876 (comment) but instead of displaying the name of the instance that one requests displaying the icon that is inside the zip folder.

But you don't need to extract the whole archive no? You could take only that specific file.
I'm not an expert but I think according to this - One, this is possible. But that's "unzip" idk if you could use it with C++ (well technically there is a source code of this package with win32/linux etc. code)
Here is another one with 7z Another one

The file itself is something like ~1-2KB, surely it can be done before instance setting window? Moreover if user exports as Prism archive, instance.cfg would be in exact same place unless they move/delete it, but in that case step with checking instance.cfg can be skipped. That's should be easy or I'm missing something?

from prismlauncher.

TheKodeToad avatar TheKodeToad commented on September 27, 2024

The offset in the file can vary, and instances are not necessarily so small. I think you can skip decompression though - but you still need to do a linear search! It's probably okay for local files (where you can skip stuff) but would be very bad for HTTP (unless you can do something fancy with ranges)...

from prismlauncher.

Related Issues (20)

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.