I want to turn my package which is a combination of application and lib into a package.
MY SITUATION
App X
is just a script.dart
file that creates files inside the root of app X
.
runs fine!
currently for testing I create a new app APP
and copy app X
inside the APP/packages
folder.
but when I run APP/packages/X/script.dart
via darteditor I get
cant open file /package/X/c:/APP/X/script.dart
which is wired since I just right click script.dart
and run.. is that a wrong path bug?
additionally I checked what if I run script.dart
from inside the APP
root folder, and I see that the script will open but as soon as I try to create/write a file with
file.writeAsStringSync(contentString, encoding: Encoding.ASCII);
I get
Breaking on exception: FileException: Cannot open file 'C:\APP' (OS Error: Access is denied.
what is the difference when developing a package and using it as a lib packages in sense of filesystem user rights?
currently my structure is
app/bin/script.dart
(scripts executed by user)
app/tool/helperScript.dart
(functions called by the script in bin)
future structure will also include
app/lib/lib.dart
and
app/lib/src/libHelper.dart
UPDATE Current Workaround In my other question how to test dart pub package someone answered:
as seen here I can use the path option in pubspec file.
so instead of having my app inside the users package folder I would
-create an application package,
-the user adds a path to my app in his pubspec (providing the path in the console)
-user executes my scripts
this workaround fixes my file access issues but since the user application would now have path
inside pubspec
1.the user can't deploy his package (without editing his pubspec)
2.the user would have to copy my console app to the server he runs his app on (hmm but I am thinking now, since the local machine is only development, he would have to do the same stuff on his production server anyway) so I guess for the moment I will stick with this approach but
I am still interests in
how to access the absolute app root path from within a lib package
Thank you
ps.
since the current solution is create application package and let the user tell you the path
and since the problem has evolved I changed the title from
How to access app root path from inside a combined app/lib package
to
How to create a combined Command-line/Library package