How to make a list of file extensions read only in JetBrains IDEs? - android-studio

I have a code generation tool (build_runner) that generates source code based on existing source files.
Every generated file is meant to be read-only.
How to tell JetBrains IDE to prevent me (as a developer) to edit those files? (or at least warn me a confirmation dialog before I actually edit the file)
Those files are identified with specific extensions
*.generated.dart
*.unwrapped.dart

Make your tool set file permissions on the files it generates: chmod 444.
Make your tool put the files in the generated folder like other libraries do.
Sample from Android Studio after setting the file permission on this file and trying to edit it:

Related

Visual C++ for Linux: copy content files to build directory?

I have a Visual C++ for Linux project in VS2017 that I'm building on a Raspberry Pi running Raspbian. This project consists of a single source file (main.c) and an image (test.jpg). When building the project, I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this
The image file's Content property is set to True, as is Included in Project. In the project properties, under Copy Sources, Sources to Copy is set to "#(SourcesToCopyRemotely)" and Copy Sources is set to "Yes". However, when I build, only main.c is copied to the Pi, and the compiler output is just a single .out file. I hoped to also see test.jpg there, but alas.
This article mentions that #(SourcesToCopyRemotely) defaults to all files in the project. However, when I evaluate the value of #(SourcesToCopyRemotely, it evaluates to just "main.c".
How do I make sure content files in my projects also end up in the build directory, along with the .out file? Preferably without having to manually enter each filename in a post-build step.
It turns out this is a bug in VC++ for Linux. A workaround, currently, is to use Additional Sources to copy. There's a caveat though: it doesn't work with remote paths that start with ~. So you can't use $(RemoteRootDir) if the Remote Build Root Directory setting is set to the default of "~/projects".
I've currently got Remote Build Root Directory set to "/home/pi/projects" and for each file I want to copy to the build directory I set Additional Sources to Copy to "[filename]:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$Configuration)/[filename]". For instance:
firstimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/firstimage.png;secondimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/secondimage.png
Right-clicking on the non-source code file to open it's properties page and flagging as Content in the General tab will cause the file to be copied to the remote. There is no need to add anything to the Copy Sources tab. The Copy Sources page of the project properties must show the default of #(SourcesToCopyRemotely). And when you edit this setting the macro should show an expansion with the additional files included.
I have found that it necessary to refresh the macro by clearing Source to Copy and then restoring it to the default after you have marked the additional files as content.
I have encountered problems when the additional files are not in the same folder as the C++ source files on the Windows host and/or you want to put them somewhere else on the remote. There are several open issues on the VCLinux GitHub site like this one so it will be worth reporting any problems you have on there.
[VCLinux 1.0.6 on VS Pro 2017 + Debian Jessie remote]
The "Pre-Build Event" section of the project properties offers "Additional Files To Copy". Addressing my file there (relative to the solution) showed following in the output when building:
Copying file 'C:\myfilepath\resource.png' to '/home/pi/projects/myproject/resource.png'
It is possible to move the files to the final destination then with Remote Post-Build Events (mv source destination). Not the most elegant way, but the first thing I got working..

Identifying file updations in NSIS

In NSIS is there any way to identify whether the application file is modified from the user side while updating the application using installer?
My requirement is while updating the application, we need to give warning message in case of user modify the application file. If 'Yes' we need to update the file, otherwise we should not update.
You probably have two options; you can get the modified time with GetFileTime or use something like the MD5 plugin (md5dll::GetMD5File).
You could save the original values in a .ini when you install and then compare with these values when updating...
Use archive attribute. Archive attribute is there especially for such purpose.
Below steps demonstrates the behaviour of archive bit:
Unset archive bit of any file in your pc, using Properties > advanced > untick "File is ready for archiving"
Edit and save the file with an appropriate tool. For example Notepad for a text file.
Note that archive bit of the file is set, signalling that this file is modified.
So the method will be like this:
Unset archive bit of all necessary source files in NSIS compiler PC
In NSIS script use [File /a] to extract the source files to destination computer preserving attributes
While reinstalling use GetFileAttributes to detect if the file is modified or original and take steps accordingly.

Check that no file is forgotten for the installshield project

we actually build an InstallShield project for our application with the functionality to include files dynamic into a component. All files will be taken which are in a specific place.
Because of problems, which are not part of this question, we want to change this to components where we add files explicit to custom separated components.
The question is, is there a best practice for this? We have the small fear that we easily can forget to add files to the component we new created. These can be dll files, .config files, pdfs or just xml.
(We build the installer every night using TFS.)
We found a solution for the problem.
What we wanted to solve:
During the build we want to be informed if files got removed
During the build we want to be informed if new files are missing
we solved this by two more or less easy things.
1. Information if a file is removed
This is easy sone, we have all files added explicitly, each single file is an own component now, if one file is missing the whole project does not build with the exact error message.
2. Information for missing files
For this we wrote a small tool which runs by a prebuild event of the installshield project.
There it opens the *.ism file as an xml file and searches for the "Files" table.
Than it takes all files from the drop folder and looks if all files are in there.
If there are files missing but we don't expect them, like pdb files or test dlls, we have an additional text file we just called "IgnoreList".
The tool skips these files by the check.
Now we are on a very good state to get informed directly on the next morning if the project was able to build or not, and if not what happened, so we can be sure that in the final target application are files are there :-)

Where are the default packages in Sublime Text 3 on Ubuntu?

I'm migrating from Sublime Text 2 to 3. In Sublime Text 2, I changed a lot of the default settings of the editor -- such as the tab bar height, sidebar color, etc. -- by modifying the Default.sublime-theme file in sublime-text-2/Packages/Theme - Default. I was also able to modify the colors of the default color schemes in a similar fashion. I've been trying to figure out how to do this for Sublime Text 3, but can't seem to find these files. ~/.config/sublime-text-3 only seems to contain overrides for user settings, not the default settings.
This link on the Sublime Text forums seems to give the location for Windows and Mac, but not for Ubuntu. I've searched a bit to no avail. Does anyone have suggestions?
Thank you!
To amplify on #skuroda's answer - ST3 contains all of its data that, in ST2, was stored in Packages/PackageName, in PackageName.sublime-package files that are basically just zip files, or "Resources" as they're now known. Using PackageResourceViewer, you can easily edit the individual files contained within the resource, then save it back again. When saved, the proper directory structure under Packages/PackageName will be created, allowing you to edit the file directly next time. The way file precedence works in Sublime, any file that exists in ~/.config/sublime-text-3/Packages/PackageName/ will override any file of the same name stored in PackageName.sublime-package.
However, since you don't want these files to be accidentally overwritten, I would suggest creating ~/config/sublime-text-3/Packages/User/Themes/ and User/Color Schemes directories and storing your customized files there instead. The User/ directory is protected from overwrites during upgrades, etc., and unless you're planning on creating a customized theme or color scheme for redistribution through Package Control, it's best practice to keep your files in there.
EDIT
I just realized you hadn't gotten an answer to your original question - where are the files stored? If you installed the .deb file from sublimetext.com, all the .sublime-package files are in /opt/sublime_text/Packages.
If you want the easiest way to save your customized settings first copy all the default settings and paste into a new file named Preferences.sublime-settings.
Then make your changes and save the file to:
/home/**username**/.config/sublime-text-3/Packages/User
In order to see the .config folder you will have to enable show hidden files.
The instructions are written at the top of the default settings list in case you are wondering where got this from.
In the ST console, try entering sublime.executable_path(). This should get you close to where you need to be. Also, you should copy the content of the file out and move them (under a new name to the packages folder). You probably don't want your modifications to be reverted on subsequent update. An alternative method is to try overriding the files you need to. I haven't done that for theme files, so I'm unsure if everything will work as it should. If you take the override route, I'd recommend using PackageResourceViewer. I wrote it to help with browsing/overriding package files in ST3.
You can use
dpkg -L <package name>
For example
dpkg -L subli<tab>
Just open up sublime text, hit ctrl+` to open sublime text console, then run these command accordingly
sublime.packages_path() to see user installed packages directory
sublime.installed_packages_path() to see zipped packages (with .sublime-package file type) directory
Mostly likely, you'll find the Default package inside zipped packages directory.
You can use PackageResourceViewer to see zipped packages's contents as #MattDMo suggested, but more over, you can actually extract zipped packages into user installed package directory directly using PackageResourceViewer's extract command.

Create a setup.exe file without any dependent files

I am a first time user of this group and so pardon me for any mistakes and unclear statements.
What I am trying to do is to create single setup.exe (not msi) using installshield. But when I build the project what I get is other files along with the .exe file for e.g. .cab, .hdr, .inx and other such files.
I am using the options under Release -> Release Wizard -> General options-> Checked the "Create a single file executable" & "Compress compiled script" options but still I get the extra files along with the setup.exe file. I want a setup.exe file to be created independent of the other local files.
So could anyone suggest me how to achieve that.
Any help will be appriciated.
Thanks.
As Michael Urman wrote, you will find the one file in adjacent folder.
The folder name is "Package".
Those files are always created for InstallScript projects. When you build a single file executable, the single file version that packages it all together is available in an adjacent folder.

Resources