If I add a "File Watcher" to compile .less files into .css files in webstorm with the default option it makes the .less file becomes a "node" and the .css file is created inside it.
The macro system seems to me a little tricky, I just want to create the .css file inside the same "style" folder in which the .less file is.
Basically now I have a structure like this:
root
|style
|-style.less
|-style.css
and my goal is to obtain a structure like this:
root
|style
|-style.less
|-style.css
any suggestion?
You will have to edit the 'File Watcher', there is Setting 'Arguments' this is what comes after the lessc command. Put somthing like this:
$FileName$ $FileNameWithoutExtension$.css
this should create your output file (.css) in the same directory.
Related
In WebStorm (2020.2.2) I accidentally named a file foo.jss and I renamed the file name to .js but WebStorm has not recognized the change. I already removed my .idea folder.
I appreciate any help or hint.
Focus the file in the Project View (just like you have on your screenshot).
Now invoke View | Quick Documentation: IDE will show a popup with file info. The info you are after is the File Type (how IDE treats this file).
I cannot say what the file type might be as it shows WebStorm's icon (never seen that before)... but .jss file extension usually stands for "JavaScript Style Sheet".
Now go to the Settings/Preferences | File Types, locate that file type in the top list, then look in the middle list (patterns) and remove such unwanted pattern (will be similar to the original file name before the rename).
If it's not under that file type... then also look through other file types, "Files Opened In Associated Applications" entry in particular (the idea based on the WebStorm file icon).
If such unwanted pattern cannot be found under any of the file types for some reason... then we need to look into the actual config files where such info is stored.
I'm working on a python code. When I change few parameters of run code every time it generates a new folder (containing files with npy extension) within main folder. I want to get access to all npy files in new folder. If I use
`os.path.listdir()`
it only lists the files in main folder.How I can approach files with npy extension?
you need to specify the path of the directory in your function
when you call:
`os.path.listdir()`
it is going to the current directory by default. If for example your new folder was called foobar then you would need to write it as something like:
path = "/foobar/"
os.listdir( path )
or equivelantly this should work also
os.listdir( "/foobar/" )
Let me know if you need any clarification
EDIT
If you want only files with the npy extension you can use the following code:
for file in os.listdir("/foobar"):
if file.endswith(".npy"):
print(os.path.join("/npy", file))
Again, let me know if you need clarification here.
I am working on a project which requires me to open an HTML file and use its contents. I added it to Resource files but when I try to open it lie this:
std::ifstream templateFile;
templateFile.open("filename.html", std::ifstream::in);
The operation fails. I checked it by using templateFile.fail().
The above operation works when I provide the full path. The file lies in the project folder along with other files. I tried setting build action to content but still it doesnt work. Please Help.
Output directory, where your executable is compiled and put into differs from the source directory, where you create all your .cpp/.hpp files (I assume there is filename.html file). Local path filename.html is supposed to be local for your executable file, not the source file.
Read more about changing the output directory here: https://msdn.microsoft.com/en-us/library/ms165410.aspx
Under Configuration Properties / Debugging, see what your Working Directory is using the macros dialog box. Move your file into this folder.
Click the button shown in the figure. There, click either Edit or Browse. Browse will take you to the working directory. Edit will expose the link to open the macros box
I frequently have to send JS files through Outlook, which means that I have to modify the extension of the file to txt or the like so the recipient can receive it. I'd ideally like to implement a file watcher in WebStorm to simply output a child file with .txt appended to it similar to how it'll show a child CSS file for a LESS file.
To sum up, given a file named "file.js", I would like it to output a "file.js.txt" as well whenever I make a change.
Is there any simple way to go about doing this?
You can create a .bat file (shell script) that would copy files and then configure it as a file watcher. Like:
copy %1 %2 /Y
Watcher settings:
Program: path/to/your/batfile.bat
Arguments: $FileName$ $FileName$.txt
Working directory: $FileDir$
Output paths: $FileName$.txt
I have written a c++ program and deployed it in say c:\my_app, and my executable's path is c:\my_app\my_app.exe. Say, my_app needs many files such as the_file.txt, which is located in c:\my_app\the_file.txt.
In my executable, I open the txt file as, xx.open("the_file.txt");
Moreover, I have associated my program with let's say .myp extension.
When I'm on Desktop, and want to open a file named example.myp, my program can not see the_file.txt. Because, it (somehow) assumes that it's currently working on Desktop.
Is there any easy way to handle this problem by changing shell command for open in HKEY_CLASSES_ROOT? The naive solution would be to change all file open operations with something like %my_app_location/the_file.txt". I don't want to do that.
Always use a full path name to open a file. In other words, don't open "foo.txt", open "c:\bar\foo.txt". To find the install directory of your EXE use GetModuleFileName(), passing NULL for the module handle.
These days you shouldn't add files to c:\my_app....
Instead use the ProgramData Folder and full paths.
Use SHGetSpecialFolderPathA with CSIDL_COMMON_APPDATA to get the ProgramData folder and the create your program directory and add your files.
You should set current directory for your app's folder with SetCurrentDirectory function. After that you can open file by name without full path