Sublime Text 3 plugin development: access own files - sublimetext2

The porting guide states that:
Packages in Sublime Text 3 are able to be run from .sublime-package
(i.e., renamed .zip files) files directly, in contrast to Sublime Text 2, which
unzipped them prior to running.
While in most changes this should lead to no differences, it is
important to keep this in mind if you are accessing files in your
package.
So how do I access files in my own package? My plugin comes with some static files that it must use.

You can use sublime.load_resource(name) where name is (from the API docs)
Loads the given resource. The name should be in the format Packages/Default/Main.sublime-menu.

Related

Ship file with flatpak

I have a json file with some data that I want to ship with my application.
I want to include it on the folder /app/share/<app-name>/data/<file>.json.
I have researched, looked on the flatpak manifest documentation and the manifest of other applications, but I saw no mention to this option.
So, how would be the proper way of adding this file on the manifest?
You can do this by adding this file as part of the "sources" field in your module, and then installing it.
An example of this in the Flathub repo for Spotify. There, we definitely have a need for shipping separate files that make the integration into your DE seamless, as Spotify doesn't ship those. Concretely, let's look at the desktop launch file that is added:
The file can be found here: https://github.com/flathub/com.spotify.Client/blob/master/com.spotify.Client.desktop
You specify the relative path as a "file" source
Add the install command to the build-commands field of your module

Enterprise Architect Generate Source Code

I am using Enterprise Architecture to generate C++ classes.
Every time I do a Generate Code, it forces me to navigate to the directory I want to save the files to. Is there a configuration setting for a project or model to tell it to always generate the files to directory X?
Using 'Auto Generate Files' (in the Code generation window) should set the path name to the files automatically, and once a file path is selected, you wouldn't have to select the directory again.

Sublime Text 3 Default File Type on new file

I was looking around and the questions and answers did not seem to match what I am looking for (Sublime Text 3). Anytime I open a new file it defaults to a plain text file. I mostly work with PHP files so I was wondering if there is a setting that would be changed so that when I open a new file it will default to PHP.
I tried to find this directory path "Packages/Text/Plain_text.tmLanguage" here:
C:\Program Files\Sublime Text 3\Packages
C:\Users\user\AppData\Roaming\Sublime Text 3\Packages
But I did not find the "tmLanguage" files.
Reference: Sublime Text 2 - Default Document Type
The .tmLanguage files are within the .sublime-package files which are secretly simple archives holding all files necessary for a package to work.
Add a .zip extension to the .sublime-package file that contains the PHP settings and you can extract the .tmLanguage file you want as your new default.
Once you have that file, follow the instructions from the question you linked to and you should be good to go.
Set default file type in Sublime Text
Rather than messing with the files in your OS and adding a .zip extension to one of them …
… if you want to find the directory path to a built-in .sublime-syntax or a .tmLanguage file install PacakgeResourceViewer from Package Control.
After installing, use command palette to Package Resource Viewer: Open Resource and find PHP.sublime-syntax.
You can then see the path is Packages/PHP/PHP.sublime-syntax.
then:
Install DefaultFileType and edit its configuration file: Packages/User/default_file_type.sublime-settings as follows:
{ "default_new_file_syntax": "Packages/PHP/PHP.sublime-syntax",
"use_current_file_syntax": false }
Now your new files will default to sublime's built-in PHP syntax highlighting.

Selenium ide to locate a file and store its path info from any computer

currently in my test scripts for automated file upload to browser, the paths are already defined in the value column
command type
target //input[#type='file']
value /Users/.../.../.../filename.extension
in such cases, this script is unable to run on other computers because the path would be different.
my question will be is
is there a way to locate the file in a general folder (for example file is downloaded and in the "download" folder), by using selenium ide can we get the path of the file (/Users/.../downloads/filename.extension)
store the path of the file with its extension into a notepad which i will be using it for multiple test of file uploads later on.
right now if my colleague needs to run the script from his computer, he have to manually change the value to his path.
You could use a suite file that contains a "setup" file to only change the file name in 1 place and the variable is shared across tests in the suite. You could also select an agreed up on place to store the files: c:\test_info\image.jpg.
Or you can make the file available by URL & not local, Unfortunately javascript prevents that for security: How to get the current file path in javascript
Unfortunately I can't think of any other good way unless you all have the same path in a home directory and could do something like ~/test_dir/photo.jpg

HTML/CSS Editor with Multi-Computer Code Folding

I'm looking for a code editor that saves folded/collapsed code. I want to be able to open the file on a 2nd computer and have the same folded/collapsed code structure. I understand that HTML/CSS cannot have this preference built in. If the editor needs to save the file in some propriety file type, I'm fine with that. I just need to be able to export it as plain HTML/CSS files once it's ready for publishing.
(Windows 7)
UltraEdit supports code folding for text files of any type and it supports also saving/restoring of folds on close/open.
In menu Advanced there is the menu item Configuration. In the settings tree navigate to Editor Display - Code Folding and enable at least the settings Save folded lines and Enable show/hide lines and code folding.
By default UltraEdit remembers which file are open with which lines hidden/folded on exit in file uedit32.ini stored on Windows computers by default in directory %APPDATA%\IDMComp\UltraEdit\. But this file contains also all other user configurations like the 2 settings I wrote above.
Therefore it is better to use a project or at least a workspace for editing the HTML/CSS files for your website(s). A project/workspace can be created in menu Project with New Project/Workspace. Using a project/workspace results in remembering which files are open on closing the project in a separate project related workspace file instead of uedit32.ini. The workspace file remembers not only the open files on closing the project, it remebers also which lines are folded, where the caret is positioned in each file, which file was the active file on close, and some other information to restore the workspace on next opening of the project/workspace.
But before creating the project/workspace, you need to enable the setting Save project information for use on multiple systems at Advanced - Configuration - File Handling - Advanced. As you can read on help page opened by clicking on button Help of this configuration dialog, this setting results in storing the workspace file of a project in same directory as the project file.
The location of the project file is defined by you on creating the project/workspace and is quite often in root directory or a subdirectory of a local copy of a website. With *.prj (the project file) and *.pui (the project user interface file = workspace file) somewhere in directory tree of the website, you have those 2 files also shared between multiple systems together with the HTML and CSS files.
See the user forum topics Create project from an existing directory tree? and Why save files to a Project? in the user-to-user forums of UltraEdit and take also a look on Tutorials/Power Tips page of IDM Computer Solutions, Inc.
SynWrite (Windows) supports it. Make some folding, then save a session file (*.syn). This file contains folded states and more. Anytime later, just open session file (menu File - Sessions) and folding (and more) restored.
You have a CSSMENU editor where you can create menu bars. This editor saves a file in such a way that it can be moved to any other pc as you mentioned . Html file will be saved and the related Css files are stored in another folder where you can move those files as your wish. No need of changing any code.