Access to a project subfolder - m2doc

I would like to insert images in my m2doc template from an image folder in a library.
I access the library with the following query :
self.siblings().eContents(libraries::LibraryReference).library.eInverse(capellamodeller::Library)
But I can't find any folder with myLibrary.eContents() and myLibrary.ownedFolders returns null.
I also tried with myLibrary.getProject() and myLibrary.getRootContainer() but the result is the same.
Is it possible to access a subfolder in a project?
Thank you for your help,
Eva

I'm not sure how images are stored, but if the file is on the file system you can access it via its path either relative to your .genconf file or absolute.
Maybe someone on the Capella forum could give you more details about image storage in Capella libraries.

Related

How can I point a folder in Documents folder?

How can I point a folder or file which stored in Documents folder?
So in my case that would be C:/Users/Vanya/Documents/ATFolder (AT Folder is folder I need)
What should I put instead "Vanya" to get into Documents folder, on any PC not just mine
In case it matters I'm trying to do this:
QDir().mkdir("C:/Users/%USERPROFILE%/Documents/ATFolder");
It responds as false and doesn't create folder.
Qt solution - QStandardPaths
Use QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); to get Documents directory.
Try to use std::getenv to get the value of the environment variable "USERPROFILE".
It worked for me.

docmosis - relative link to file

I try to create a report (PDF/WORD) using docmosis.
In my report, I would like one of the fields to point to a file that resides relatively to the output-report. Is it possible? I saw the documentation that says I have to add to the template the prefix link:, e.g. <<link:linkToFile>> so docmosis understands this is a link. However, in the output report this links to a directory which does not even exist under %TMP% folder (C:\Users\ohadr\AppData\Local\Temp...).
Is there a way to add a link to file with docmosis? And how about relative file?
The <<link:abc>> directive is intended for external links which can be to files to download etc. Currently it will not reference any relative content/file.

Get absolute path of the file in vc++/visual studio

I am new to VC++ programming. I am developing a program where in I have to get absolute path of a *.bmp file from all the folders in a directory dynamically. I am able to navigate to every folder in the directory dynamically but not able to get absolute path of the files.
I am not able to use "GetFullPathName", I am not sure if this will solve the purpose.
Please help.
If you are using CFileFind to locate the files, you should be able to use CFileFind::GetFilePath () to get the complete path.

File I/O from current Windows position C++

I have not yet found a definitive answer about this. I am trying to have access to files in subfolders from my .EXE. When I have asked before, people tell me to use the absolute location i.e. "c:/game/info/" if I wanted to access something in /info/
But it is completely unreasonable for me or anyone to assume that someone is going to use their program from the same directory. What if the user only has a D drive? That sort of thing.
So my question is: how can I access a file in a subdirectory from my executable without relying on the entire path?
Your title says "Windows", so I'll give a WinAPI-specific answer.
On Windows, you can find your application directory with GetModuleFileName(NULL, ...), and PathRemoveFileSpec. Then PathAppend will make the full path to your data files.
Or you can store the data inside you .exe file as Win32 resources, so they never get separated.
Please note that this approach generally works only for read-only access to data files. If you try to write files in your application directory, you might be blocked by ACLs (depending on install location and local security settings of the computer).
Use GetModuleFileName (Retrieves the fully-qualified path for the file that contains the specified module. The module must have been loaded by the current process.)
char strExePath [MAX_PATH];
GetModuleFileName (NULL, strExePath, MAX_PATH);
You'll then need to extract the folder path (someone has already posted how to do that), and combine your path.
Make or use an installer that asks the user where to install the executable and writes that path to the registry in a well-known location for later reference.
if you use:
#include <fstream>
ifstream stream("file");
it will be working. "file" is file in directory with your exe. Of course if you want go up or down in folders hierarchy use "..\file" or "folder\file"

Uploading files with an ImageField and saving them to a static location

I have a problem with my app here. My configuration is as such I can upload a new release and symbolically link it for production -- however, this means every time I upload a new release, all of the photos that were uploaded in any parts of my entire project are wrapped into the old release and disappear.
How can I save these files to a static file location which does not get wrapped in the release? Thanks in advance.
I guess best for this is keeping your media files out of your source project folder, you could eg have a structure like:
myproject
|
|----media
|----src
There's no need to have the media folder in the same directory as your source code, apps etc. So you have a solution where the dir with your release only contains static files! The same applies to the database, if you are using sqlite... Have a look at this for a more detailled structure!
Of course this no must, but experience shows it makes live much easier!