Use Electron to select specific folder with program in it, and install files into directory - node.js

So I'm currently looking for a method to open a specific folder, containing let's say FiveM.exe
When the folder is selected it should download and install some files to it.
Is this even possible with Electron?
And how would you go around and do so, I know how to do a select folder and file dialog, but the rest I'm not too sure about.

Related

Copying files/folders to Electron Dist folder

Long story short:
I need to copy some files/directories over from my src folder to my dist/resources folder. Is there any way I can 'automatically' copy these files/folders over during packaging? I am using Electron-packager.
Long story:
I have a couple of folders containing JSON files that need to be read and copied over to a certain user directory. These are all done when I mount a certain component.
I use readFileSync() and using path.resolve with __dirname - but this generates an error since my relative path is different when I am running the packaged app (inside dist folder). Error is it cannot find my JSON file in dist/resources/config/settings.json. Also tried to check content of my app.asar but can't seem to find it there.
So my working workaround is to copy the directory/files over from my src folder to my dist/resources folder.
But this is kind of hacky and prone to forgetting. Is there any way I can 'automatically' copy these files/folders over during packaging?
I've seen a lot of questions like this and I've never really understood them. Maybe your project structure is very different than mine (below)?
Everything that is within my "app" directory is included by electron-packager (or electron-builder – I use both) and so it's all available when the app i packaged. In my case I have some Excel templates which the user can opt to save to disk but I could just as well create a directory and copy them there at first launch (haven't tried this but assuming permissions are ok I don't doubt that it will work). Maybe that is less "clean" than having a separate resources folder?
That said, I have seen this: Electron - How to add external files?

How to use a folder and file with the same name but different case from github in windows 10?

I want to clone a github repo that uses two different files/folders:
\packages\ - Folder
\Packages - File
However, due to windows not using Case Sensitive File/Directory Names, this isnt working, it gives me the error that the folder cant be renamed because a file already has the same name.
The program that uses this project REQUIRES that there be a no-extension binary text file Packages (Its like a giant file full of control files (If you recognize linux debian youll understand)
But it also requires a folder named \packages\ to hold the json files containing the config data for each control file within Packages
This question is an updated form of this previous question, which is outdated, and doesnt have an answer that solves the problem: Working in git with directories with the same name but different case in Windows
From Windows 10's update in April of 2018, they added a feature to "enable" case-sensitivity on specific directories.
I simply used the command on my github storage directory and now my project works fine.
To use the feature: Open a command prompt window (I dont believe this requires Administrator, it didnt for me)
Copy the full directory path to the folder you want to enable the flag on, type in the console:
fsutil.exe file SetCaseSensitiveInfo #:\Path\To\Directory\Here enable
Paste your C:/D:/E: or whatever Drive path into the location above. Then hit enter.
You DO NOT need to restart your computer, the flag seems to take effect immediately
Info sourced from: https://www.windowscentral.com/how-enable-ntfs-treat-folders-case-sensitive-windows-10#enable_case_sensitivity_ntfs_windows10

Why can't I copy/paste img assets from one project into new directories in second project's drawable folder?

I downloaded a project from Github, trying to rebuild it myself for learning purposes. I'm new to Android Studio, developing on a Mac. Having trouble with what I think would be simple tasks.
The source project from Github I downloaded has several different sub directories containing image resources under the res/drawable folder. I was hoping I could just copy and paste these assets into my own project. It doesn't seem to work the way I'd expect and I don't understand what is going on.
I've tried right clicking and copy/pasting the directory I'd like to duplicate from the Github project (opened in Android Studio) into the drawable folder in my new project (Also opened in AS). Nothing seems to happen when I do this. Right clicking and selecting "reveal in finder" reveals a still unfortunately empty drawable folder.
I also tried right clicking on the specific directory I'd like to copy from the Github project and selecting "reveal in finder", thinking I'd try copying and pasting it from there into my new project. Oddly enough when I do this, the same directory isn't even the one that's opened. Instead, it opens a drawable-hdpi folder containing several assets, but it's definitely not the one I was attempting to open.
I've tried right clicking and "synchronizing" the drawable folder in my new project after copy/pasting, still no luck.
You can not copy android folders or directories directly into android studio. But you can copy individual files into there respective folders in your project.
If you want to copy folders/ directories you can open the android app folder in your MAC browser and go to Application/app/src/main and paste whatever you have in the respective folders.
The main folder conrains java and res folders and an AndroidManifest.xml file.
You can paste xml files , drawables and pngs etc in res and java classes will go into java folder.

Publish Web App files to different locations

I'm start to develop modules for DotNetNuke. I followed different tutorials(most by Chris Hammond) but there is something i don't like, and I'm searching a different way to do so.
He recommends to put a DotNetNuke installation, with IIS and SQL Server, on the developer PC and put your Project into the DesktopModules folder. I don't like it because i want to separate my project from DotNetNuke.
Is there a way to split the build/publish to different location like dll into folder x and all other stuff into folder y?
You could, but I don't really see the point. I see where you're coming from because it seemed awkward to me at first as well, but it really is the most efficient way to develop on the DNN platform. I have mine set up so all of my modules are in the same solution and branched in source from the root DNN folder. We don't keep the DNN core in source so the developer is responsible for that, although that may change at some point to keep versioning consistent.
By keeping your project located where it's installed, you can develop your modules the same way you'd develop any other web app you're building. If you make a change in markup you just have to save the file and refresh your page. If you change something in code just build and refresh.
If you really must keep them separate, you can absolutely do so (really the only benefit of this that I can see is that if you uninstall a module and accidentally click the checkbox to delete files - it happens - you don't have to worry about it). Create your project where you want it, change the Output Path to your DNN bin folder, and create post-build events to copy all of your .js, .ascx, and .css files (plus any others you may need - images, HTML files, XML files, etc.) to appropriate folder(s) in the DesktopModules folder. Just remember that you have to build the project every time you make ANY changes to test them, and you have to write/change your post-build events every time you add a new type of resource, change/add a directory, etc.
Either that or you can build an install package and uninstall/reinstall the module every time you change some padding in your stylesheet ... but I'd stick with keeping the project in the DesktopModules folder.
Sure you can do that.
Set up your solution and module projects anywhere, build the projects and copy the appropriate parts (such as the *.ascx , *.ascx.resx, *.dnn files) back to your website folder -
website/ DesktopModules/Your_module_name
Copy the module dll to the website's bin and you good to go.

Linux Folder/Package Management

I'm looking for a way to store all my applications files within a single folder. However, when someone clicks on the folder I want the application inside the folder to open up as opposed to open the folder itself. I want to keep all dependancies and files inside this folder at all times.
I'm doing this because I'm going to be deploying a couple applications on a common framework and want to ensure that they are together and independent of the distribution have all requirements.
Folders are directories, and directories are distinct from files. There's no way to redirect a directory to an executable file. However, you can make a hidden directory (begin name with ".") and use an executable file to provide access to that directory. The directory will then not appear in window manager folders, just the application. However, window managers will not misrepresent the executable file as a directory.

Resources